from __future__ import annotations

from django.db import models
from orgs.models import Organization


class Lead(models.Model):
    organization = models.ForeignKey(Organization, on_delete=models.CASCADE, related_name="leads")
    name = models.CharField(max_length=255)
    email = models.EmailField(blank=True)
    phone = models.CharField(max_length=64, blank=True)
    subject = models.CharField(max_length=255, blank=True)
    message = models.TextField(blank=True)
    source = models.CharField(max_length=64, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self) -> str:  # pragma: no cover
        return f"Lead {self.name} ({self.organization.code})"

