{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://postflight.co/aeronautiql/planning/v1/results/resolved-route-v1.schema.json",
  "title": "Existing Rust ResolvedRoute v1 passthrough",
  "description": "Compatibility schema for router::resolved_route::ResolvedRoute. Property names intentionally remain snake_case.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "algorithm_revision",
    "network_revision",
    "identity",
    "route_string",
    "navigation_revision",
    "navigation_cycle",
    "effective_cycle",
    "navigation_valid_from_unix",
    "navigation_valid_until_unix",
    "interpolation",
    "provenance",
    "lateral_status",
    "constraints_status",
    "points",
    "distance_nm",
    "selections",
    "required_procedures",
    "issues",
    "procedure_record_digests"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "algorithm_revision": { "type": "string", "minLength": 1 },
    "network_revision": { "type": "string", "minLength": 1 },
    "identity": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
    "route_string": { "type": "string" },
    "navigation_revision": { "type": "string", "minLength": 1 },
    "navigation_cycle": { "type": ["string", "null"] },
    "effective_cycle": { "type": ["string", "null"] },
    "navigation_valid_from_unix": { "type": ["integer", "null"] },
    "navigation_valid_until_unix": { "type": ["integer", "null"] },
    "interpolation": { "type": "string", "minLength": 1 },
    "provenance": { "type": "string", "minLength": 1 },
    "lateral_status": { "enum": ["complete", "approximate", "incomplete"] },
    "constraints_status": { "type": "string", "minLength": 1 },
    "points": {
      "type": "array",
      "maxItems": 20000,
      "items": { "$ref": "#/$defs/vertex" }
    },
    "distance_nm": { "type": "number", "minimum": 0 },
    "selections": {
      "type": "array",
      "maxItems": 1000,
      "items": { "$ref": "#/$defs/selection" }
    },
    "required_procedures": {
      "type": "array",
      "maxItems": 1000,
      "items": { "$ref": "#/$defs/procedureNeed" }
    },
    "runways": {
      "type": "array",
      "maxItems": 1000,
      "items": { "$ref": "#/$defs/runway" }
    },
    "issues": {
      "type": "array",
      "maxItems": 10000,
      "items": { "$ref": "#/$defs/issue" }
    },
    "procedure_record_digests": {
      "type": "object",
      "additionalProperties": { "type": "string", "minLength": 1 }
    }
  },
  "$defs": {
    "vertex": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "latitude", "longitude"],
      "properties": {
        "id": { "type": "string", "minLength": 1 },
        "latitude": { "type": "number", "minimum": -90, "maximum": 90 },
        "longitude": { "type": "number", "minimum": -180, "maximum": 180 },
        "owner": { "type": "string", "minLength": 1 }
      }
    },
    "selection": {
      "type": "object",
      "additionalProperties": false,
      "required": ["token_index"],
      "properties": {
        "token_index": { "type": "integer", "minimum": 0 },
        "runway": { "type": ["string", "null"] },
        "transition": { "type": ["string", "null"] }
      }
    },
    "procedureNeed": {
      "type": "object",
      "additionalProperties": false,
      "required": ["token_index", "airport", "procedure", "kind"],
      "properties": {
        "token_index": { "type": "integer", "minimum": 0 },
        "airport": { "type": "string", "minLength": 1 },
        "procedure": { "type": "string", "minLength": 1 },
        "kind": { "type": "string", "minLength": 1 }
      }
    },
    "runway": {
      "type": "object",
      "additionalProperties": false,
      "required": ["token_index", "airport", "role", "runway"],
      "properties": {
        "token_index": { "type": "integer", "minimum": 0 },
        "airport": { "type": "string", "minLength": 1 },
        "role": { "type": "string", "minLength": 1 },
        "runway": { "type": "string", "minLength": 1 }
      }
    },
    "issue": {
      "type": "object",
      "additionalProperties": false,
      "required": ["code", "message"],
      "properties": {
        "code": { "type": "string", "minLength": 1 },
        "message": { "type": "string", "minLength": 1 },
        "token_index": { "type": "integer", "minimum": 0 }
      }
    }
  }
}
