from typing import Literal, Optional

from pydantic import BaseModel, EmailStr, Field


class PublicContactInfoResponse(BaseModel):
    whatsapp_number: str
    whatsapp_display: str
    whatsapp_url: str
    email_info: str
    email_sales: str
    phone: str
    company: str = "CNP Solutions"


class PublicContactRequest(BaseModel):
    name: str = Field(..., min_length=2, max_length=120)
    email: EmailStr
    phone: Optional[str] = Field(None, max_length=30)
    subject: str = Field(..., min_length=2, max_length=200)
    message: str = Field(..., min_length=5, max_length=4000)
    source: str = Field("CNPERP", max_length=80)
    preferred_channel: Literal["whatsapp", "email"] = "whatsapp"


class PublicContactResponse(BaseModel):
    success: bool
    message: str
    whatsapp_url: str
    mailto_url: str
    email_sent: bool = False
    whatsapp_api_sent: bool = False
