///|
/// Machine-readable metadata for selecting and explaining the route engine.
pub(all) struct AlgorithmMetadata {
  id : String
  name : String
  version : String
  objective : String
  deterministic : Bool
  supports_constraints : Bool
  complexity : String
  limitations : Array[String]
} derive(Eq, Debug, FromJson, ToJson)

///|
pub fn algorithm_metadata() -> AlgorithmMetadata {
  {
    id: "routeable.constrained-dijkstra",
    name: "Constrained weighted Dijkstra",
    version: "1.0",
    objective: "minimize profile-specific friction after hard accessibility filtering",
    deterministic: true,
    supports_constraints: true,
    complexity: "O(V^2 + V*E) with array-backed graph storage",
    limitations: [
      "intended for bounded, carefully maintained spaces", "does not ingest live traffic or emergency conditions",
      "requires locally verified accessibility data",
    ],
  }
}

///|
pub fn algorithm_metadata_json() -> String {
  ToJson::to_json(algorithm_metadata()).stringify(indent=2)
}

///|
pub fn debug_graph_summary(graph : Graph) -> String {
  let findings = validate_graph(graph)
  "nodes=\{graph.nodes.length()}, edges=\{graph.edges.length()}, findings=\{findings.length()}"
}