"""Pydantic schema for contact form."""
from pydantic import BaseModel, EmailStr, field_validator


class ContactCreate(BaseModel):
    name: str
    email: EmailStr
    phone: str | None = None
    message: str
    privacy_consent: bool

    @field_validator("privacy_consent")
    @classmethod
    def consent_must_be_true(cls, v: bool) -> bool:
        if not v:
            raise ValueError("privacy_consent must be True")
        return v


class ContactResponse(BaseModel):
    success: bool
