"""Contact schemas — create, update, read, list.""" from __future__ import annotations from pydantic import BaseModel, Field class ContactCreate(BaseModel): first_name: str = Field(..., min_length=1, max_length=100) last_name: str = Field(..., min_length=1, max_length=100) email: str | None = Field(None, max_length=255) phone: str | None = Field(None, max_length=30) mobile: str | None = Field(None, max_length=30) position: str | None = Field(None, max_length=100) department: str | None = Field(None, max_length=100) linkedin_url: str | None = Field(None, max_length=500) notes: str | None = None address_street: str | None = Field(None, max_length=255) address_city: str | None = Field(None, max_length=100) address_zip: str | None = Field(None, max_length=20) address_country: str | None = Field(None, max_length=2) address_state: str | None = Field(None, max_length=100) company_ids: list[str] | None = None class ContactUpdate(BaseModel): first_name: str | None = Field(None, min_length=1, max_length=100) last_name: str | None = Field(None, min_length=1, max_length=100) email: str | None = Field(None, max_length=255) phone: str | None = Field(None, max_length=30) mobile: str | None = Field(None, max_length=30) position: str | None = Field(None, max_length=100) department: str | None = Field(None, max_length=100) linkedin_url: str | None = Field(None, max_length=500) notes: str | None = None address_street: str | None = Field(None, max_length=255) address_city: str | None = Field(None, max_length=100) address_zip: str | None = Field(None, max_length=20) address_country: str | None = Field(None, max_length=2) address_state: str | None = Field(None, max_length=100) class ContactResponse(BaseModel): id: str first_name: str last_name: str email: str | None = None phone: str | None = None mobile: str | None = None position: str | None = None department: str | None = None linkedin_url: str | None = None notes: str | None = None address_street: str | None = None address_city: str | None = None address_zip: str | None = None address_country: str | None = None address_state: str | None = None created_at: str | None = None updated_at: str | None = None class ContactDetailResponse(ContactResponse): companies: list[dict] = Field(default_factory=list) class ContactListResponse(BaseModel): items: list[ContactResponse] total: int page: int page_size: int class CompanyLinkRequest(BaseModel): role_at_company: str | None = Field(None, max_length=100) is_primary: bool = False