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

class INPCBase(BaseModel):
    year: str = Field(..., max_length=4, description="Year (YYYY)")
    month: str = Field(..., max_length=2, description="Month (MM)")
    value: Optional[Decimal] = Field(None, description="INPC Value")


class INPCCreate(INPCBase):
    pass

class INPCUpdate(BaseModel):
    year: Optional[str] = Field(None, max_length=4)
    month: Optional[str] = Field(None, max_length=2)
    value: Optional[Decimal] = None


class INPCResponse(INPCBase):
    id: int
    tenant_id: int
    company_id: int  

    model_config = ConfigDict(from_attributes=True)