"""Segment and SegmentEffort data models."""

from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional


@dataclass
class Segment:
    id: str
    name: str
    polyline: list[list[float]]     # [[lat, lon], ...]
    distance_m: float
    bbox: list[float]               # [lon_min, lat_min, lon_max, lat_max]
    created_by: str
    created_at: datetime
    sport: Optional[str] = None     # None = any sport


@dataclass
class SegmentEffort:
    activity_id: str
    started_at: datetime
    elapsed_s: int
    detected_at: datetime
    avg_speed_kmh: Optional[float] = None
    avg_hr_bpm: Optional[int] = None
    avg_power_w: Optional[int] = None
    np_power_w: Optional[int] = None
