"""Global Place Recognition schemas (Component F08)."""

from typing import Optional

import numpy as np
from pydantic import BaseModel

from gps_denied.schemas import GPSPoint
from gps_denied.schemas.satellite import TileBounds


class TileCandidate(BaseModel):
    """A matched satellite tile candidate."""
    tile_id: str
    gps_center: GPSPoint
    bounds: TileBounds
    similarity_score: float
    rank: int
    spatial_score: Optional[float] = None


class DatabaseMatch(BaseModel):
    """Raw index match from Faiss queries."""
    index: int
    tile_id: str
    distance: float
    similarity_score: float


class SatelliteTile(BaseModel):
    """A stored satellite tile representation for indexing."""
    model_config = {"arbitrary_types_allowed": True}

    tile_id: str
    image: np.ndarray
    gps_center: GPSPoint
    bounds: TileBounds
    descriptor: Optional[np.ndarray] = None
