{
  "openapi" : "3.1.0",
  "info" : {
    "title" : "LiveMap Routing Facade (v1)",
    "description" : "v1 facade for multi-profile product route comparison.",
    "version" : "11.0-livemap-1.1-SNAPSHOT"
  },
  "tags" : [ {
    "name" : "Routing v1",
    "description" : "LiveMap facade for product-profile route comparison. Transitional: superseded by the v2 navigation surfaces (/api/v2/routing/route + /plan). Frozen to maintenance; see decision-log.md and ADR-0018."
  } ],
  "paths" : {
    "/api/v1/routing/openapi.json" : {
      "get" : {
        "tags" : [ "Routing v1" ],
        "summary" : "Return the v1 OpenAPI document",
        "description" : "OpenAPI 3.1 contract for the v1 facade, generated at runtime from the live resource. v2 navigation has its own document at /api/v2/routing/openapi.json.",
        "operationId" : "openApi",
        "responses" : {
          "200" : {
            "description" : "OpenAPI 3.1 JSON document",
            "content" : {
              "application/json" : {
                "schema" : { }
              }
            }
          }
        }
      }
    },
    "/api/v1/routing/profiles" : {
      "get" : {
        "tags" : [ "Routing v1" ],
        "summary" : "Return the configured LiveMap product profile catalog",
        "operationId" : "profiles",
        "responses" : {
          "200" : {
            "description" : "Profile catalog keyed by product profile name (currently foot_fast, foot_safe, foot_calm). Each value carries base_profile and the per-dimension preference weights.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "additionalProperties" : true
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    },
    "/api/v1/routing/route" : {
      "post" : {
        "tags" : [ "Routing v1" ],
        "summary" : "Calculate one route per requested LiveMap product profile",
        "description" : "Resolves the temporal bucket, then routes each requested product profile over the LiveMap-weighted graph. Deprecated: use POST /api/v2/routing/plan for fully-navigable multi-profile alternatives (OSRM-compatible).",
        "operationId" : "route",
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/LivemapRouteRequest"
              }
            }
          }
        },
        "responses" : {
          "200" : {
            "description" : "Routing result. status is \"ok\" with one entry per profile in routes, or \"no_route\" with per-profile routeErrors.",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/LivemapRouteResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Invalid request body, profile, or bucket",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/LivemapErrorResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Misconfigured profile catalog or unexpected server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/LivemapErrorResponse"
                }
              }
            }
          }
        },
        "deprecated" : true
      }
    }
  },
  "components" : {
    "schemas" : {
      "Geometry" : {
        "properties" : {
          "type" : {
            "type" : "string"
          },
          "coordinates" : {
            "type" : "array",
            "items" : {
              "type" : "array",
              "items" : {
                "type" : "number",
                "format" : "double"
              }
            }
          }
        }
      },
      "Instruction" : {
        "properties" : {
          "text" : {
            "type" : "string"
          },
          "distance" : {
            "type" : "number",
            "format" : "double"
          },
          "time" : {
            "type" : "integer",
            "format" : "int64"
          },
          "sign" : {
            "type" : "integer",
            "format" : "int32"
          },
          "interval" : {
            "type" : "array",
            "items" : {
              "type" : "integer",
              "format" : "int32"
            }
          }
        }
      },
      "LivemapRouteResponse" : {
        "properties" : {
          "status" : {
            "type" : "string"
          },
          "resolvedBucket" : {
            "type" : "string"
          },
          "routes" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/RouteResult"
            }
          },
          "routeErrors" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/RouteError"
            }
          }
        }
      },
      "RouteError" : {
        "properties" : {
          "profile" : {
            "type" : "string"
          },
          "code" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          }
        }
      },
      "RouteResult" : {
        "properties" : {
          "profile" : {
            "type" : "string"
          },
          "distanceMeters" : {
            "type" : "number",
            "format" : "double"
          },
          "timeMillis" : {
            "type" : "integer",
            "format" : "int64"
          },
          "geometry" : {
            "$ref" : "#/components/schemas/Geometry"
          },
          "instructions" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Instruction"
            }
          },
          "details" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "array",
              "items" : {
                "type" : "array",
                "items" : {
                  "type" : "object"
                }
              }
            }
          },
          "debug" : {
            "type" : "object",
            "additionalProperties" : {
              "type" : "object"
            }
          }
        }
      },
      "LivemapErrorResponse" : {
        "properties" : {
          "status" : {
            "type" : "string"
          },
          "code" : {
            "type" : "string"
          },
          "message" : {
            "type" : "string"
          }
        }
      },
      "LivemapRouteRequest" : {
        "description" : "v1 multi-profile route request.",
        "properties" : {
          "points" : {
            "type" : "array",
            "description" : "Ordered waypoints as [longitude, latitude] pairs (at least 2).",
            "example" : [ [ 8.5417, 47.3769 ], [ 8.55, 47.38 ] ],
            "items" : {
              "type" : "array",
              "description" : "Ordered waypoints as [longitude, latitude] pairs (at least 2).",
              "example" : [ [ 8.5417, 47.3769 ], [ 8.55, 47.38 ] ],
              "items" : {
                "type" : "number",
                "format" : "double",
                "description" : "Ordered waypoints as [longitude, latitude] pairs (at least 2)."
              }
            }
          },
          "profiles" : {
            "type" : "array",
            "description" : "Product profile names to route (at least 1), e.g. foot_fast, foot_safe, foot_calm (the configured catalog; see GET /profiles).",
            "example" : [ "foot_fast", "foot_safe", "foot_calm" ],
            "items" : {
              "type" : "string",
              "description" : "Product profile names to route (at least 1), e.g. foot_fast, foot_safe, foot_calm (the configured catalog; see GET /profiles).",
              "example" : "[\"foot_fast\",\"foot_safe\",\"foot_calm\"]"
            }
          },
          "bucket" : {
            "type" : "string",
            "default" : "auto",
            "description" : "Temporal safety/presence bucket. \"auto\" resolves against Europe/Zurich wall-clock time (weekday/weekend x morning/afternoon/night).",
            "enum" : [ "auto", "wd_am", "wd_pm", "wd_nt", "we_am", "we_pm", "we_nt" ]
          },
          "debug" : {
            "type" : "boolean",
            "default" : false,
            "description" : "Internal direct-use only; the frontend API need not forward this."
          },
          "details" : {
            "type" : "boolean",
            "default" : false,
            "description" : "When true, each route carries a details object with per-edge path details (edge_id, osm_way_id, road_class, lm_* dims at the resolved bucket)."
          }
        },
        "required" : [ "points", "profiles" ]
      }
    }
  }
}