from dataclasses import dataclass
from datetime import datetime
from typing import Protocol

@dataclass(slots=True)
class ClientAppointmentStats:
    total_spend: float
    appointment_count: int


@dataclass(slots=True)
class PermissiveBookResult:
    success: bool
    stylist_id: str | None = None
    appointment_id: str | None = None
    reason: str | None = None


class BookingRepository(Protocol):
    async def get_client_stats(self, client_id: str) -> ClientAppointmentStats: ...

    async def list_active_offers(self, salon_id: str) -> list[dict]: ...

    async def pick_stylist_permissive(
        self, salon_id: str, service_id: str
    ) -> str | None: ...

    async def get_service_for_booking(self, service_id: str) -> dict | None: ...

    async def create_appointment(
        self,
        *,
        salon_id: str,
        service_id: str,
        client_id: str,
        stylist_id: str,
        start: datetime,
        end: datetime,
        appointment_fee: float,
        offer_id: str | None,
        generated_by: str,
    ) -> str: ...
