// COMPILE-TIME STUB — see ../MapMap.kt header. `-PskipMapmap` builds only.
package ai.mapmap.routing

import ai.mapmap.stubOnly
import ai.mapmap.territory.TerritoryStore

data class RoutePoint(val latitude: Double, val longitude: Double)

/**
 * On-device route query. `costing` uses Valhalla costing model names
 * ("auto", "bicycle", "pedestrian"); `alternates` = extra routes beyond the
 * primary.
 */
class RouteQuery(
  val costing: String,
  val locations: List<RoutePoint>,
  val alternates: Int = 0,
)

/** One maneuver; `type` is the Valhalla maneuver type code. */
class Maneuver(
  val type: Int,
  val instruction: String,
  val lengthMeters: Double,
  val position: RoutePoint,
  val roundaboutExitCount: Int?,
)

/** One computed route with decoded geometry. */
class Route(
  val geometry: List<RoutePoint>,
  val distanceMeters: Double,
  val durationSeconds: Double,
  val maneuvers: List<Maneuver>,
)

interface OfflineRouter {
  /** Primary route first, alternates after; empty/throws when unroutable. */
  suspend fun route(query: RouteQuery): List<Route>
}

/** Valhalla-backed on-device router over the installed territory's tiles. */
class ValhallaMobileRouter(val store: TerritoryStore) : OfflineRouter {
  override suspend fun route(query: RouteQuery): List<Route> = stubOnly()
}

/** Facade named in the 0.2.0 surface summary. */
object OfflineRouting {
  fun router(store: TerritoryStore): OfflineRouter = ValhallaMobileRouter(store)
}
