"""Pydantic schemas for filter presets."""

from datetime import datetime
from typing import Optional

from pydantic import BaseModel


class FilterValues(BaseModel):
    """The actual filter values stored in a preset."""

    jahr: Optional[int] = None
    fallgruppe: Optional[str] = None
    has_icd: Optional[str] = None
    search: Optional[str] = None


class FilterPresetCreate(BaseModel):
    """Request body for creating a filter preset."""

    name: str
    filters: FilterValues


class FilterPresetResponse(BaseModel):
    """Response for a filter preset."""

    id: int
    name: str
    filters: FilterValues
    created_at: datetime

    model_config = {"from_attributes": True}
