Metadata-Version: 2.4
Name: turfslot-utils
Version: 0.1.0
Summary: Core business logic utilities for validating, pricing, and checking availability of badminton, table tennis, and tennis turf slots.
Project-URL: Homepage, https://example.com/turfslot-utils
Project-URL: Repository, https://example.com/turfslot-utils/repo
Author-email: TurfEase Solutions <devnull@example.com>
License: MIT
Keywords: badminton,booking,sports,table-tennis,tennis,turf
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# turfslot-utils

Core business logic helpers for booking badminton, table tennis, and tennis turf slots.  
The package provides reusable dataclasses and services to validate slots, detect clashes, and compute prices so that any Python application (web, CLI, or automation) can reuse the same rules.

## Installation

Once released to PyPI:

```bash
pip install turfslot-utils
```

For local development from this repository:

```bash
pip install .
```

## Quick start

```python
from datetime import datetime, timezone

from turfslot_utils import (
    Court,
    SlotPriceCalculator,
    SlotRangeValidator,
    SportAvailabilityChecker,
    CourtNotAvailableError,
)

court = Court(
    court_id="C1",
    sport_type="BADMINTON",
    name="Smash Arena",
    hourly_rate=400,
)

validator = SlotRangeValidator()
slot = validator.validate(
    sport_type="BADMINTON",
    court_id="C1",
    start_time=datetime(2025, 1, 10, 9, 0, tzinfo=timezone.utc),
    end_time=datetime(2025, 1, 10, 11, 0, tzinfo=timezone.utc),
)

checker = SportAvailabilityChecker()
existing_bookings = []  # Populate from your storage layer
try:
    checker.check_availability(slot, existing_bookings)
except CourtNotAvailableError:
    print("Court already booked!")
else:
    total = SlotPriceCalculator().calculate_price(slot, court)
    print(f"Booking confirmed. Price: INR {total}")
```

## Testing

```bash
python -m pytest
```

## Building and publishing

```bash
python -m pip install --upgrade build twine
python -m build
# TestPyPI upload
python -m twine upload --repository testpypi dist/*
# PyPI upload (set TWINE_PASSWORD or use keyring)
python -m twine upload dist/*
```

Keep credentials outside source control and pass them via environment variables or a secure keyring.
