from app.schemas.base import CamelModel


class RouteResponse(CamelModel):
    id: int
    name: str
    version_group_id: int
    order: int
    parent_route_id: int | None = None
    pinwheel_zone: int | None = None
    encounter_methods: list[str] = []


class GameResponse(CamelModel):
    id: int
    name: str
    slug: str
    generation: int
    region: str
    category: str | None = None
    box_art_url: str | None
    release_year: int | None
    color: str | None
    version_group_id: int | None = None


class RouteWithChildrenResponse(RouteResponse):
    children: list[RouteResponse] = []


class GameDetailResponse(GameResponse):
    routes: list[RouteResponse] = []


# --- Admin schemas ---


class GameCreate(CamelModel):
    name: str
    slug: str
    generation: int
    region: str
    category: str | None = None
    box_art_url: str | None = None
    release_year: int | None = None
    color: str | None = None


class GameUpdate(CamelModel):
    name: str | None = None
    slug: str | None = None
    generation: int | None = None
    region: str | None = None
    category: str | None = None
    box_art_url: str | None = None
    release_year: int | None = None
    color: str | None = None


class GenlockeDefaultsResponse(CamelModel):
    true_genlocke: str  # game slug for true genlocke default
    normal_genlocke: str  # game slug for normal genlocke default


class RegionResponse(CamelModel):
    name: str
    generation: int
    order: int
    genlocke_defaults: GenlockeDefaultsResponse
    games: list[GameResponse] = []


class RouteCreate(CamelModel):
    name: str
    order: int
    parent_route_id: int | None = None
    pinwheel_zone: int | None = None


class RouteUpdate(CamelModel):
    name: str | None = None
    order: int | None = None
    parent_route_id: int | None = None
    pinwheel_zone: int | None = None


class RouteReorderItem(CamelModel):
    id: int
    order: int


class RouteReorderRequest(CamelModel):
    routes: list[RouteReorderItem]
