from django.db import models
from common.models import NameSlugModel

# Create your models here.
class City(NameSlugModel):
    class Meta:
        verbose_name = "شهر"
        verbose_name_plural = "شهرها"

    def __str__(self):
        return self.name

class County(NameSlugModel):
    city = models.ForeignKey(City, on_delete=models.CASCADE, verbose_name="استان")

    class Meta:
        verbose_name = "شهرستان"
        verbose_name_plural = "شهرستان‌ها"

    def __str__(self):
        return self.name
    
class Affairs(NameSlugModel):
    county = models.ForeignKey(County, on_delete=models.CASCADE, verbose_name="شهرستان")

    class Meta:
        verbose_name = "امور"
        verbose_name_plural = "امورها"

    def __str__(self):
        return self.name

class Broker(NameSlugModel):
    affairs = models.ForeignKey(Affairs, on_delete=models.CASCADE, verbose_name="امور")

    class Meta:
        verbose_name = "کارگزار"
        verbose_name_plural = "کارگزارها"

    def __str__(self):
        return self.name