"""Clinic policy validators — Phase 13.3."""
from __future__ import annotations

from shared.exceptions import AppError


def validate_clinic_policy_windows(*, booking_lead_time_hours: int, cancellation_window_hours: int) -> None:
    if cancellation_window_hours > booking_lead_time_hours:
        raise AppError(
            "پنجره لغو نمی‌تواند بیشتر از زمان پیش‌نیاز رزرو باشد",
            status_code=422,
            error_code="invalid_policy_windows",
            details={
                "booking_lead_time_hours": booking_lead_time_hours,
                "cancellation_window_hours": cancellation_window_hours,
            },
        )


def validate_weekly_hours(weekly_hours: dict) -> None:
    if not weekly_hours:
        raise AppError(
            "ساعات هفتگی الزامی است",
            status_code=422,
            error_code="weekly_hours_required",
        )
