from django.db import models
from iems_backend.models import UUIDTimeStampedModel

# Create your models here.


class CheckPoint(UUIDTimeStampedModel):
    name = models.CharField(max_length=255)
    location = models.CharField(max_length=255)
    is_active = models.BooleanField(default=True)

    facility_type = models.ForeignKey(
        "FacilityType",
        on_delete=models.SET_NULL,
        null=True,
        blank=True,
        related_name="checkpoints",
        help_text="The facility type this checkpoint belongs to.",
    )

    def __str__(self):
        return f"{self.name} {self.location}"


class FacilityType(UUIDTimeStampedModel):

    name = models.CharField(max_length=255)
    description = models.TextField(blank=True, null=True)

    def __str__(self):
        return self.name
