from pydantic import BaseModel, ConfigDict, Field
from typing import Optional


class CartaPorteDTO(BaseModel):
    id: int
    code: str = Field(..., max_length=20)
    description: str = Field(..., max_length=2000)
    similar_words: Optional[str] = Field(None, max_length=2000)
    is_hazardous: int = 0
    start_date: Optional[str] = None
    end_date: Optional[str] = None

    model_config = ConfigDict(from_attributes=True)
