"""Appointment list specifications — Phase 13.1."""
from __future__ import annotations

from dataclasses import dataclass
from datetime import datetime
from uuid import UUID

from app.models.types import AppointmentStatus

ALLOWED_SORT_FIELDS = frozenset(
    {"created_at", "scheduled_start", "status", "code", "updated_at"}
)


@dataclass
class AppointmentListSpec:
    status: AppointmentStatus | None = None
    doctor_id: UUID | None = None
    clinic_id: UUID | None = None
    patient_id: UUID | None = None
    date_from: datetime | None = None
    date_to: datetime | None = None
    q: str | None = None
    sort_by: str = "scheduled_start"
    sort_dir: str = "desc"
