"""Limpyd models for the ``limpyd_database`` tests"""

from limpyd.fields import StringField
from django.utils.functional import cached_property

from mtp.apps.common.limpyd_base import DjangoBackedRedisModel, DjangoBackedRedisModelWithLogs

from .models import DjangoTestModelWithLogs

class RedisTestModel(DjangoBackedRedisModel):
    """Simple limpyd model to test the django-limpyd connection

    Attributes
    ----------
    some_field : limpyd field, instance of ``limpyd.fields.StringField``
        Simply used to store data to test

    """

    some_field = StringField()

    @cached_property
    def django_model(self):
        """Get the django model to link this limpyd model to

        Returns
        -------
        DjangoTestModel
            The ``limpyd_base.models.DjangoTestModel`` model
        """
        from .models import DjangoTestModel
        return DjangoTestModel


class RedisTestModelwithLogs(DjangoBackedRedisModelWithLogs):
    """Simple limpyd model to test the logging capability of the limpy model"""

    django_model = DjangoTestModelWithLogs
