from enum import Enum
from pydantic import BaseModel, EmailStr, Field, ValidationError, field_validator


class InquiryType(str, Enum):
    data_as_a_service = "Data-as-a-Service"
    vapt_services = "VAPT Services"
    security_testing = "Security Testing"
    threat_modelling = "Threat Modelling"
    application_security = "Application Security"
    software_development = "Software Development"
    agentic_ai_software_development = "Agentic AI Software Development"
    general_inquiry = "General Inquiry"


class ContactCreate(BaseModel):
    first_name: str = Field(..., min_length=1, max_length=50)
    last_name: str = Field(..., min_length=1, max_length=50)
    email: EmailStr = Field(..., max_length=255)
    company_name: str = Field(..., min_length=1, max_length=100)
    country: str = Field(..., min_length=1, max_length=100)
    job_title: str = Field(..., min_length=1, max_length=100)
    inquiry_type: InquiryType
    message: str = Field(..., min_length=10, max_length=2000)
    privacy_policy_agreement: bool = Field(...)
    captcha_token: str = Field(..., min_length=1)

    @field_validator("privacy_policy_agreement")
    @classmethod
    def validate_privacy_policy_agreement(cls, value: bool) -> bool:
        if value is not True:
            raise ValueError("privacy_policy_agreement must be true")
        return value


class ContactResponse(BaseModel):
    id: str
    created_at: str
    message: str = "Submission received"

    class Config:
        orm_mode = True
