"""
DTOs para el catálogo de claves FDA
"""
from pydantic import BaseModel, Field
from typing import Optional


class FDACatalogCreate(BaseModel):
    """DTO para crear una entrada en el catálogo FDA"""
    fda_key: str = Field(..., max_length=20, description="Clave FDA")
    description: str = Field(..., max_length=500, description="Descripción")
    fda_code: Optional[str] = Field(None, max_length=50, description="Código FDA")
    requirements: Optional[str] = Field(None, max_length=500, description="Requerimientos")
    manufacturer_number: Optional[str] = Field(None, max_length=50, description="Número de fabricante")
    country_of_production: Optional[str] = Field(None, max_length=100, description="País de producción")
    storage_status: Optional[str] = Field(None, max_length=100, description="Estatus de almacenaje")
    warehouse_code: Optional[str] = Field(None, max_length=20, description="Código de almacén")
    call_atl: Optional[str] = Field(None, max_length=20, description="CallAtl")

    model_config = {
        "from_attributes": True
    }


class FDACatalogUpdate(BaseModel):
    """DTO para actualizar una entrada en el catálogo FDA"""
    fda_key: Optional[str] = Field(None, max_length=20, description="Clave FDA")
    description: Optional[str] = Field(None, max_length=500, description="Descripción")
    fda_code: Optional[str] = Field(None, max_length=50, description="Código FDA")
    requirements: Optional[str] = Field(None, max_length=500, description="Requerimientos")
    manufacturer_number: Optional[str] = Field(None, max_length=50, description="Número de fabricante")
    country_of_production: Optional[str] = Field(None, max_length=100, description="País de producción")
    storage_status: Optional[str] = Field(None, max_length=100, description="Estatus de almacenaje")
    warehouse_code: Optional[str] = Field(None, max_length=20, description="Código de almacén")
    call_atl: Optional[str] = Field(None, max_length=20, description="CallAtl")

    model_config = {
        "from_attributes": True
    }


class FDACatalogResponse(BaseModel):
    """DTO para respuesta del catálogo FDA"""
    id: int
    fda_key: str
    description: str
    fda_code: Optional[str]
    requirements: Optional[str]
    manufacturer_number: Optional[str]
    country_of_production: Optional[str]
    storage_status: Optional[str]
    warehouse_code: Optional[str]
    call_atl: Optional[str]
    created_at: Optional[str]
    updated_at: Optional[str]

    model_config = {
        "from_attributes": True
    }
