"""Domain entity: PreschoolPlanningDays. One row per (child, year): how many "förskolans planeringsdagar" (preschool closure/planning days, e.g. "studiedagar") that child's preschool has for a given year, and how many were actually taken. `taken_days` is nullable on purpose: `None` means "not recorded yet", which must be distinguishable from "recorded, and it was zero" — that distinction is the whole point of this slice. Before this table existed, `app/services/allocation_service.py::_preschool_reserve_days` could only multiply `Child.preschool_planning_days_per_year` (see `app/entities/child.py`) by the number of years in the planning horizon and subtract the lump sum from both parents' pools, with no way to know the true per-year number or how many parental-leave days that assumption actually cost. NOTE for whoever wires the allocation engine to this table (tracked as a follow-up, not done in this change): a (child, year) pair with no row here means "use `Child.preschool_planning_days_per_year` as the planned figure, taken unknown" — callers must fall back to that default rather than treating a missing row as zero days. """ from dataclasses import dataclass from datetime import datetime from uuid import UUID @dataclass class PreschoolPlanningDays: id: UUID child_id: UUID year: int planned_days: int taken_days: int | None = None created_at: datetime | None = None updated_at: datetime | None = None