from django.db import models
from django.utils.translation import gettext_lazy as _
from rules.contrib.models import RulesModelBase, RulesModelMixin


class ServalaModelMixin(RulesModelMixin, models.Model, metaclass=RulesModelBase):
    created_at = models.DateTimeField(
        auto_now_add=True, editable=False, verbose_name=_("Created")
    )
    updated_at = models.DateTimeField(
        auto_now=True, editable=False, verbose_name=_("Last updated")
    )

    class Meta:
        abstract = True
        ordering = ("-created_at",)
