"""API schemas (Pydantic) for DayAssertion. Schemas are the API boundary — they validate request bodies and shape responses, kept separate from the domain entity so the wire format can evolve independently. """ from datetime import date, datetime from uuid import UUID from pydantic import BaseModel, Field from app.entities.day_assertion import DayAssertion class DayAssertionCreate(BaseModel): workspace_id: UUID child_id: UUID parent_personal_data_uuid: UUID date: date day_type: str = Field(pattern="^(sjukpenning|lagsta|vacation|none)$") is_dubbeldag: bool = False # Attachment only (band naming) — None means an ad-hoc assertion. See # `app.entities.day_assertion.DayAssertion`. wish_id: UUID | None = None class DayAssertionResponse(BaseModel): id: UUID workspace_id: UUID child_id: UUID parent_personal_data_uuid: UUID date: date day_type: str is_dubbeldag: bool wish_id: UUID | None created_at: datetime | None updated_at: datetime | None @classmethod def from_entity(cls, entity: DayAssertion) -> "DayAssertionResponse": return cls( id=entity.id, workspace_id=entity.workspace_id, child_id=entity.child_id, parent_personal_data_uuid=entity.parent_personal_data_uuid, date=entity.date, day_type=entity.day_type, is_dubbeldag=entity.is_dubbeldag, wish_id=entity.wish_id, created_at=entity.created_at, updated_at=entity.updated_at, )