{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "PULSAR normalized input dataset v1",
  "description": "No source acquisition. UTF-8 JSON; all timestamps explicit UTC/offset. Runtime adds cross-field/range/conflict validation.",
  "type": "object",
  "required": [
    "schema_version",
    "dataset_id",
    "sources",
    "orbit",
    "series"
  ],
  "properties": {
    "schema_version": {
      "const": "pulsar.compute.input.v1"
    },
    "dataset_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200
    },
    "sources": {
      "type": "array",
      "maxItems": 1000,
      "items": {
        "type": "object",
        "required": [
          "id",
          "sha256"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "sha256": {
            "type": "string",
            "pattern": "^[0-9a-f]{64}$"
          },
          "file": {
            "type": "string"
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "kind": {
            "type": "string"
          },
          "coverage_start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "coverage_end": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          }
        }
      }
    },
    "orbit": {
      "type": "object",
      "required": [
        "frame",
        "center",
        "time_scale",
        "position_unit",
        "velocity_unit",
        "kind",
        "samples"
      ],
      "properties": {
        "frame": {
          "const": "ICRF"
        },
        "center": {
          "const": "Earth"
        },
        "time_scale": {
          "const": "UTC"
        },
        "position_unit": {
          "const": "km"
        },
        "velocity_unit": {
          "const": "km/s"
        },
        "kind": {
          "enum": [
            "historical_reconstruction",
            "prediction",
            "observation"
          ]
        },
        "samples": {
          "type": "array",
          "maxItems": 150000,
          "items": {
            "type": "object",
            "required": [
              "time",
              "position_km",
              "velocity_km_s",
              "source_id",
              "raw_locator"
            ],
            "properties": {
              "time": {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              "position_km": {
                "type": "array",
                "minItems": 3,
                "maxItems": 3,
                "items": {
                  "type": "number",
                  "minimum": -100000000.0,
                  "maximum": 100000000.0
                }
              },
              "velocity_km_s": {
                "type": "array",
                "minItems": 3,
                "maxItems": 3,
                "items": {
                  "type": "number",
                  "minimum": -100,
                  "maximum": 100
                }
              },
              "source_id": {
                "type": "string"
              },
              "raw_locator": {
                "type": "string",
                "minLength": 1,
                "maxLength": 500
              },
              "published_at": {
                "anyOf": [
                  {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                    "format": "date-time"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        }
      }
    },
    "series": {
      "type": "array",
      "maxItems": 100000,
      "items": {
        "type": "object",
        "required": [
          "id",
          "metric",
          "value",
          "unit",
          "valid_start",
          "valid_end",
          "kind",
          "source_id",
          "raw_locator"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "metric": {
            "enum": [
              "kp",
              "ap_forecast",
              "proton_event_probability",
              "m_flare_probability",
              "x_flare_probability",
              "f107_forecast"
            ]
          },
          "value": {
            "type": "number"
          },
          "unit": {
            "enum": [
              "index",
              "percent",
              "sfu"
            ]
          },
          "valid_start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "valid_end": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "kind": {
            "enum": [
              "observation",
              "external_forecast",
              "historical_reconstruction"
            ]
          },
          "quality": {
            "enum": [
              "valid",
              "missing",
              "invalid",
              "suspect"
            ]
          },
          "source_id": {
            "type": "string"
          },
          "raw_locator": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "metric": {
                  "const": "kp"
                }
              }
            },
            "then": {
              "properties": {
                "unit": {
                  "const": "index"
                },
                "value": {
                  "minimum": 0,
                  "maximum": 9
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "metric": {
                  "const": "ap_forecast"
                }
              }
            },
            "then": {
              "properties": {
                "unit": {
                  "const": "index"
                },
                "value": {
                  "minimum": 0,
                  "maximum": 500
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "metric": {
                  "const": "proton_event_probability"
                }
              }
            },
            "then": {
              "properties": {
                "unit": {
                  "const": "percent"
                },
                "value": {
                  "minimum": 0,
                  "maximum": 100
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "metric": {
                  "const": "m_flare_probability"
                }
              }
            },
            "then": {
              "properties": {
                "unit": {
                  "const": "percent"
                },
                "value": {
                  "minimum": 0,
                  "maximum": 100
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "metric": {
                  "const": "x_flare_probability"
                }
              }
            },
            "then": {
              "properties": {
                "unit": {
                  "const": "percent"
                },
                "value": {
                  "minimum": 0,
                  "maximum": 100
                }
              }
            }
          },
          {
            "if": {
              "properties": {
                "metric": {
                  "const": "f107_forecast"
                }
              }
            },
            "then": {
              "properties": {
                "unit": {
                  "const": "sfu"
                },
                "value": {
                  "minimum": 0,
                  "maximum": 1000
                }
              }
            }
          }
        ]
      }
    },
    "events": {
      "type": "array",
      "maxItems": 15000,
      "items": {
        "type": "object",
        "required": [
          "id",
          "type",
          "start",
          "source_id",
          "raw_locator"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "type": {
            "enum": [
              "FLR",
              "CME",
              "CME_ARRIVAL",
              "GST",
              "SEP",
              "RADIO",
              "OTHER"
            ]
          },
          "start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "end": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "peak_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "decision_usable": {
            "type": "boolean",
            "default": false
          },
          "class_type": {
            "type": "string",
            "pattern": "^[ABCMX]\\d+(?:\\.\\d+)?$"
          },
          "origin": {
            "type": "string"
          },
          "parent_event_id": {
            "type": "string"
          },
          "source_id": {
            "type": "string"
          },
          "raw_locator": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "allOf": [
          {
            "if": {
              "properties": {
                "type": {
                  "const": "FLR"
                }
              }
            },
            "then": {
              "required": [
                "class_type"
              ]
            }
          }
        ]
      }
    },
    "catalogs": {
      "type": "array",
      "maxItems": 1000,
      "items": {
        "type": "object",
        "required": [
          "source_id",
          "type",
          "start",
          "end",
          "status"
        ],
        "properties": {
          "source_id": {
            "type": "string"
          },
          "type": {
            "enum": [
              "FLR",
              "CME",
              "GST",
              "SEP",
              "NOAA_XRA"
            ]
          },
          "start": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "end": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "enum": [
              "loaded",
              "loaded_empty",
              "missing",
              "error"
            ]
          }
        }
      }
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "notes": {
      "type": [
        "array",
        "string"
      ]
    },
    "conjunctions": {
      "type": "array",
      "maxItems": 50000,
      "items": {
        "type": "object",
        "required": [
          "id",
          "tca",
          "iss_norad_cat_id",
          "object_norad_cat_id",
          "object_name",
          "object_type",
          "is_debris",
          "min_range_km",
          "relative_speed_km_s",
          "max_probability",
          "source_id",
          "raw_locator"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "tca": {
            "type": "string",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
            "format": "date-time"
          },
          "iss_norad_cat_id": {
            "const": 25544
          },
          "object_norad_cat_id": {
            "type": "integer",
            "minimum": 1,
            "maximum": 999999999
          },
          "object_name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 300
          },
          "object_type": {
            "enum": [
              "PAY",
              "R/B",
              "DEB",
              "UNK"
            ]
          },
          "object_ops_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "is_debris": {
            "type": "boolean",
            "description": "Normalized upstream: true for orbital debris relevant to the team, typically R/B, DEB, or confirmed non-operational payloads; active payloads should be false."
          },
          "min_range_km": {
            "type": "number",
            "minimum": 0,
            "maximum": 100000
          },
          "relative_speed_km_s": {
            "type": "number",
            "minimum": 0,
            "maximum": 100
          },
          "max_probability": {
            "type": "number",
            "minimum": 0,
            "maximum": 1,
            "description": "Event-level maximum conjunction probability from the upstream screening product; not astronaut-hit probability."
          },
          "dilution_threshold_km": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "maximum": 100000
          },
          "published_at": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{1,6})?(?:Z|[+-]\\d{2}:\\d{2})$",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ]
          },
          "decision_usable": {
            "type": "boolean"
          },
          "source_id": {
            "type": "string"
          },
          "raw_locator": {
            "type": "string",
            "minLength": 1,
            "maxLength": 500
          }
        }
      },
      "description": "Normalized ISS conjunction-screening records. Empty or absent does not mean zero debris risk unless a covering screening source is present."
    }
  }
}
