"""Pydantic-модели и константы для публичных GPS-треков (ET-008)."""
from pydantic import BaseModel
from typing import Optional, List

ACTIVITY_TYPES = [
    "enduro", "moto", "offroad", "bicycle", "hike", "ski", "other"
]


class TrackRecord(BaseModel):
    """Трек из БД, готовый к отдаче через API."""

    id: int
    dedup_key: str
    name: Optional[str] = None
    description: Optional[str] = None
    activity_type: Optional[str] = "other"
    user: Optional[str] = None
    created_at: Optional[str] = None
    length_m: float
    points_count: int
    min_lon: float
    min_lat: float
    max_lon: float
    max_lat: float
    sources: List[str]
    external_urls: List[str]
    tags: List[str]
    inserted_at: str
    updated_at: str


class TrackInsert(BaseModel):
    """Трек для вставки в БД (из парсера)."""

    external_id: str
    source_id: str
    external_url: Optional[str] = None
    name: Optional[str] = None
    description: Optional[str] = None
    activity_type: str = "other"
    user: Optional[str] = None
    created_at: Optional[str] = None
    length_m: float
    points_count: int
    geom_wkb: bytes  # WKB bytes
    min_lon: float
    min_lat: float
    max_lon: float
    max_lat: float
    tags: List[str] = []
    source_priority: int = 999
