from datetime import datetime, timezone

import pytest

from turfslot_utils import Court, SlotPriceCalculator, SlotRangeValidator


def _slot_on(day: int, hour: int, duration_hours: int = 2):
    validator = SlotRangeValidator()
    start = datetime(2025, 1, day, hour, 0, tzinfo=timezone.utc)
    end = start.replace(hour=hour + duration_hours)
    return validator.validate("TENNIS", "C1", start, end)


def _court():
    return Court(court_id="C1", sport_type="TENNIS", name="Court 1", hourly_rate=500)


def test_price_calculation_weekday():
    slot = _slot_on(8, 8)  # Wednesday
    price = SlotPriceCalculator().calculate_price(slot, _court())
    assert price == pytest.approx(1000.0)


def test_weekend_multiplier_applied():
    slot = _slot_on(11, 8)  # Saturday
    price = SlotPriceCalculator().calculate_price(slot, _court())
    assert price == pytest.approx(1200.0)
