from pydantic import BaseModel
from typing import Optional
from datetime import date, datetime


class ScheduledShiftCreate(BaseModel):
    user_id: int
    scheduled_date: date
    start_time: str   # "HH:MM"
    end_time: str     # "HH:MM"
    notes: Optional[str] = None


class ScheduledShiftUpdate(BaseModel):
    start_time: Optional[str] = None
    end_time: Optional[str] = None
    notes: Optional[str] = None


class ScheduledShiftOut(BaseModel):
    id: int
    user_id: int
    user_name: Optional[str] = None
    hourly_rate: Optional[float] = None
    scheduled_date: date
    start_time: str
    end_time: str
    notes: Optional[str] = None
    created_by_id: int
    created_at: datetime
    # computed
    duration_hours: Optional[float] = None
    estimated_pay: Optional[float] = None

    model_config = {"from_attributes": True}
