{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Optional orbital render declaration; additive to dynamic theme 0.2",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "orbit": {
      "type": "object",
      "required": [
        "model"
      ],
      "additionalProperties": true,
      "properties": {
        "model": {
          "type": "string",
          "minLength": 1
        },
        "central_body": {
          "type": "string",
          "minLength": 1
        },
        "reference_frame": {
          "type": "string",
          "minLength": 1
        },
        "epoch": {
          "type": "string",
          "format": "date-time",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}[Tt]\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:[Zz]|[+-]\\d{2}:\\d{2})$"
        },
        "altitude_km": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "inclination_deg": {
          "type": "number",
          "minimum": 0,
          "maximum": 180
        },
        "raan_deg": {
          "type": "number",
          "minimum": 0,
          "exclusiveMaximum": 360
        },
        "phase_deg": {
          "type": "number",
          "minimum": 0,
          "exclusiveMaximum": 360
        }
      }
    },
    "camera": {
      "type": "object",
      "required": [
        "reference_frame"
      ],
      "additionalProperties": true,
      "properties": {
        "reference_frame": {
          "type": "string",
          "minLength": 1
        },
        "position_km": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "target_km": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "up": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "items": {
            "type": "number"
          }
        },
        "horizontal_fov_deg": {
          "type": "number",
          "exclusiveMinimum": 0,
          "exclusiveMaximum": 180
        }
      }
    }
  },
  "allOf": [
    {
      "if": {
        "required": [
          "orbit"
        ],
        "properties": {
          "orbit": {
            "required": [
              "model"
            ],
            "properties": {
              "model": {
                "const": "circular"
              }
            }
          }
        }
      },
      "then": {
        "required": [
          "orbit",
          "camera"
        ],
        "properties": {
          "orbit": {
            "required": [
              "model",
              "central_body",
              "reference_frame",
              "epoch",
              "altitude_km",
              "inclination_deg",
              "raan_deg",
              "phase_deg"
            ]
          },
          "camera": {
            "required": [
              "reference_frame",
              "position_km",
              "target_km",
              "up",
              "horizontal_fov_deg"
            ]
          }
        }
      }
    },
    {
      "if": {
        "required": [
          "camera"
        ],
        "properties": {
          "camera": {
            "required": [
              "reference_frame"
            ],
            "properties": {
              "reference_frame": {
                "const": "orbit_rtn"
              }
            }
          }
        }
      },
      "then": {
        "required": [
          "orbit",
          "camera"
        ],
        "properties": {
          "orbit": {
            "required": [
              "model",
              "central_body",
              "reference_frame",
              "epoch",
              "altitude_km",
              "inclination_deg",
              "raan_deg",
              "phase_deg"
            ]
          },
          "camera": {
            "required": [
              "reference_frame",
              "position_km",
              "target_km",
              "up",
              "horizontal_fov_deg"
            ]
          }
        }
      }
    }
  ]
}
