from typing import Optional from pydantic import BaseModel, Field class CustomsBrokerBaseDTO(BaseModel): """Base fields for CustomsBroker""" type: Optional[str] = None name: Optional[str] = None address: Optional[str] = None postal_code: Optional[str] = None city: Optional[str] = None state: Optional[str] = None phone: Optional[str] = None fax: Optional[str] = None email: Optional[str] = None country: Optional[str] = None tax_id: Optional[str] = None personal_id: Optional[str] = None position: Optional[str] = None license: Optional[str] = Field(None, max_length=4, pattern=r"^\d*$") company: Optional[str] = None contact: Optional[str] = None class CustomsBrokerCreateDTO(CustomsBrokerBaseDTO): """Schema for creating a new CustomsBroker""" broker_key: str = Field(..., max_length=5, pattern=r"^[a-zA-Z0-9]+$", description="Clave única del agente aduanal (máx 5 caracteres)") class CustomsBrokerUpdateDTO(CustomsBrokerBaseDTO): """Schema for updating an existing CustomsBroker""" pass class CustomsBrokerResponseDTO(CustomsBrokerBaseDTO): """Schema for CustomsBroker response""" id: int broker_key: str tenant_id: int company_id: int class Config: from_attributes = True # Legacy DTO for backwards compatibility (if needed elsewhere) class CustomsBrokerDTO(BaseModel): type: Optional[str] = None broker_key: str = Field(..., max_length=5, pattern=r"^[a-zA-Z0-9]+$") name: Optional[str] = None address: Optional[str] = None postal_code: Optional[str] = None city: Optional[str] = None state: Optional[str] = None phone: Optional[str] = None fax: Optional[str] = None email: Optional[str] = None country: Optional[str] = None tax_id: Optional[str] = None personal_id: Optional[str] = None position: Optional[str] = None license: Optional[str] = Field(None, max_length=4, pattern=r"^\d*$") company: Optional[str] = None contact: Optional[str] = None tenant_id: str company_id: str class Config: from_attributes = True class CustomsBrokerVUCreateDTO(BaseModel): certificate_path: Optional[str] key_path: Optional[str] access_key: Optional[str] fiel_format: Optional[str] signature_read_path: Optional[str] archive_path: Optional[str] fiel_access_key: Optional[str] web_service_user: Optional[str] web_service_access_key: Optional[str] vu_email: Optional[str] vu_figure_type: Optional[str] xml_files_path: Optional[str] query_tax_id: Optional[str] doda_certificate_path: Optional[str] doda_key_path: Optional[str] doda_web_service_user: Optional[str] doda_web_service_access_key: Optional[str] doda_fiel_access_key: Optional[str] doda_xml_files_path: Optional[str] class Config: from_attributes = True class CustomsBrokerPersonnelDTO(BaseModel): broker_key: str = Field(..., max_length=5, pattern=r"^[a-zA-Z0-9]+$") line: int name: Optional[str] tax_id: Optional[str] personal_id: Optional[str] position: Optional[str] license: Optional[str] = Field(None, max_length=4, pattern=r"^\d*$") first_name: Optional[str] last_name: Optional[str] middle_name: Optional[str] email: Optional[str] class Config: from_attributes = True