from django.db import models

class Client(models.Model):
    name = models.CharField(max_length=200, verbose_name="Client Name")
    email = models.EmailField(max_length=200, verbose_name="Email", blank=True, null=True)
    phone = models.CharField(max_length=20, verbose_name="Phone", blank=True, null=True)

    def __str__(self):
        return self.name

class Project(models.Model):
    STATUS_CHOICES = [
        ('planning', 'Planning'),
        ('in_progress', 'In Progress'),
        ('completed', 'Completed'),
    ]

    name = models.CharField(max_length=200, verbose_name="Project Name")
    client = models.ForeignKey(Client, on_delete=models.CASCADE, related_name='projects', verbose_name="Client", null=True, blank=True)
    start_date = models.DateField(verbose_name="Start Date")
    end_date = models.DateField(verbose_name="End Date")
    status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='planning', verbose_name="Status")

    def __str__(self):
        return self.name