from django.db import models
from django.utils.translation import gettext_lazy as _

from apps.shared.models import AbstractBaseModel


class GalleryCategory(AbstractBaseModel):
    name = models.CharField(max_length=255, verbose_name=_("Nomi"))
    count = models.BigIntegerField(default=0, verbose_name=_("Soni"))
    gallery = models.ManyToManyField(
        "Gallery", related_name="gallery_category", verbose_name=_("Galereya")
    )

    class Meta:
        verbose_name = _("Galereya kategoriya")
        verbose_name_plural = _("Galereya kategoriyalar")
        ordering = ["-created_at"]

    def __str__(self) -> str:
        return self.name
