{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://postflight.co/aeronautiql/planning/v1_1/results/table-replay.schema.json",
  "title": "Unchanged native v2 table replay alongside the trajectory payload",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "performance"
  ],
  "properties": {
    "schema_version": {
      "const": 2
    },
    "performance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "model_id",
        "catalog_revision",
        "witness_revision",
        "resolved_climb_isa_deviation_c",
        "source_initial_weight_lb",
        "initial_weight_before_allowances_lb",
        "pre_climb_allowance_fuel_lb",
        "departure_weight_lb",
        "top_of_climb_weight_lb",
        "arrival_weight_lb",
        "modeled_fuel_burn_lb",
        "derived_source_weight_mapping",
        "aircraft_limits_verified",
        "climb_temperature_reference",
        "source_weight_reference_provenance",
        "applicability",
        "sources",
        "quality_flags",
        "notes",
        "temperature_policy",
        "source_weight_reference",
        "departure_weight_reference"
      ],
      "properties": {
        "model_id": {
          "type": "string",
          "minLength": 1
        },
        "catalog_revision": {
          "type": "string",
          "minLength": 1
        },
        "witness_revision": {
          "type": "string",
          "minLength": 1
        },
        "resolved_climb_isa_deviation_c": {
          "type": "number"
        },
        "source_initial_weight_lb": {
          "type": "number"
        },
        "initial_weight_before_allowances_lb": {
          "type": "number"
        },
        "pre_climb_allowance_fuel_lb": {
          "type": "number"
        },
        "departure_weight_lb": {
          "type": "number"
        },
        "top_of_climb_weight_lb": {
          "type": "number"
        },
        "arrival_weight_lb": {
          "type": "number"
        },
        "modeled_fuel_burn_lb": {
          "type": "number"
        },
        "derived_source_weight_mapping": {
          "type": "boolean"
        },
        "aircraft_limits_verified": {
          "type": "boolean"
        },
        "climb_temperature_reference": {},
        "source_weight_reference_provenance": {},
        "applicability": {
          "type": "object"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "quality_flags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "temperature_policy": {
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "const": "forecast_at_top_of_climb"
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind",
                "isa_deviation_c"
              ],
              "properties": {
                "kind": {
                  "const": "manual_isa_deviation"
                },
                "isa_deviation_c": {
                  "type": "number"
                }
              }
            }
          ]
        },
        "source_weight_reference": {
          "enum": [
            "published_double_entry",
            "sea_level_origin",
            "fixed_published_reference"
          ]
        },
        "departure_weight_reference": {
          "enum": [
            "table_climb_start",
            "before_fixed_ground_allowance"
          ]
        },
        "calculation_assumptions": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "version",
            "source_weight_limit",
            "authorized_temperature_estimate"
          ],
          "properties": {
            "version": {
              "const": 1
            },
            "source_weight_limit": {
              "type": "boolean"
            },
            "authorized_temperature_estimate": {
              "type": "boolean"
            }
          }
        },
        "weight_limit": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "requested_departure_weight_lb",
            "calculation_departure_weight_lb",
            "supported_maximum_departure_weight_lb",
            "departure_pressure_altitude_ft",
            "cruise_pressure_altitude_ft",
            "resolved_isa_deviation_c",
            "limiting_domain"
          ],
          "properties": {
            "requested_departure_weight_lb": {
              "type": "number"
            },
            "calculation_departure_weight_lb": {
              "type": "number"
            },
            "supported_maximum_departure_weight_lb": {
              "type": "number"
            },
            "departure_pressure_altitude_ft": {
              "type": "number"
            },
            "cruise_pressure_altitude_ft": {
              "type": "number"
            },
            "resolved_isa_deviation_c": {
              "type": "number"
            },
            "maximum_top_of_climb_weight_lb": {
              "type": "number"
            },
            "limiting_domain": {
              "enum": [
                "climb_source_weight",
                "cruise_source_weight"
              ]
            }
          }
        },
        "temperature_estimate": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "label",
            "basis",
            "policy_id",
            "payload_revision",
            "effective_source_isa_deviation_c",
            "forecast_climb_isa_deviation_c",
            "published_isa_deviation_domain_c",
            "applies_to",
            "actual_temperature_uses"
          ],
          "properties": {
            "label": {
              "type": "string"
            },
            "basis": {
              "type": "string"
            },
            "policy_id": {
              "type": "string"
            },
            "payload_revision": {
              "type": "string"
            },
            "effective_source_isa_deviation_c": {
              "type": "number"
            },
            "forecast_climb_isa_deviation_c": {
              "type": "number"
            },
            "applies_to": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "actual_temperature_uses": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "published_isa_deviation_domain_c": {
              "type": "array",
              "minItems": 2,
              "maxItems": 2,
              "items": {
                "type": "number"
              }
            }
          }
        },
        "source_native": {
          "$ref": "source-native-replay.schema.json"
        },
        "range_estimate": {
          "type": "object",
          "additionalProperties": false,
          "required": ["policy", "total_fuel_burn_lb", "crossings"],
          "properties": {
            "policy": { "const": "estimate" },
            "total_fuel_burn_lb": { "type": "number", "minimum": 0 },
            "usable_fuel_lb": { "type": "number", "exclusiveMinimum": 0 },
            "reserve_lb": { "type": "number", "minimum": 0 },
            "shortfall_lb": { "type": "number", "minimum": 0 },
            "crossings": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["boundary", "route_distance_nm", "elapsed_seconds", "fuel_burn_lb"],
                "properties": {
                  "boundary": {
                    "enum": ["reserve_requirement_exceeded", "usable_fuel_exhausted", "minimum_cruise_weight"]
                  },
                  "route_distance_nm": { "type": "number", "minimum": 0 },
                  "elapsed_seconds": { "type": "number", "minimum": 0 },
                  "fuel_burn_lb": { "type": "number", "minimum": 0 }
                }
              }
            },
            "weight_hold": {
              "type": "object",
              "additionalProperties": false,
              "required": ["minimum_cruise_weight_lb", "held_from_route_distance_nm"],
              "properties": {
                "minimum_cruise_weight_lb": { "type": "number", "exclusiveMinimum": 0 },
                "held_from_route_distance_nm": { "type": "number", "minimum": 0 },
                "ledger_below_basic_operating_weight": { "type": "boolean" }
              }
            }
          }
        }
      }
    }
  }
}
