{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Record DL0 FITS Schema",
  "type": "object",
  "properties": {
    "aaid": { "type": "string" },
    "aipvers": { "type": "string" },
    "archive": {
      "type": "object",
      "properties": {
        "PFN": { "type": "string" },
        "PFNP": { "type": "string" },
        "archdate": { "type": "string", "format": "date-time" },
        "archtime": { "type": "integer" },
        "checksum": { "type": "string" },
        "container": { "type": "string" },
        "dataset": { "type": "string" },
        "filesize": { "type": "integer" },
        "paths": {
          "type": "object",
          "properties": {
            "RSE": { "type": "string" },
            "replicaflag": { "type": "integer" },
            "type": { "type": "string" },
            "uid": { "type": "string" },
            "uripath": { "type": "string", "format": "uri" }
          },
          "required": ["RSE", "replicaflag", "type", "uid", "uripath"]
        },
        "replicas": {
          "type": "object",
          "properties": {
            "replica": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "number": { "type": "string" },
                  "rdata": { "type": "string", "format": "date-time" },
                  "rid": { "type": "string" },
                  "rtype": { "type": "string" },
                  "spool": { "type": "string" },
                  "uri": { "type": "string", "format": "uri" }
                },
                "required": ["number", "rdata", "rid", "rtype", "spool", "uri"]
              }
            }
          },
          "required": ["replica"]
        },
        "scope": { "type": "string" }
      },
      "required": [
        "PFN", "PFNP", "archdate", "archtime", "checksum", "container",
        "dataset", "filesize", "paths", "replicas", "scope"
      ]
    },
    "author": { "type": "string" },
    "camera": { "type": "string" },
    "daqmode": { "type": "string" },
    "datadesc": { "type": "string" },
    "datatype": { "type": "string" },
    "dateobs": { "type": "string", "format": "date" },
    "event": {
      "type": "object",
      "properties": {
        "obsdate": { "type": "string", "format": "date" }
      },
      "required": ["obsdate"]
    },
    "file_version": { "type": "integer" },
    "filename": { "type": "string" },
    "fsize": { "type": "integer" },
    "header": {
      "type": "object",
      "properties": {
        "Primary": {
          "type": "object",
          "properties": {
            "ALT_PNT": { "type": "integer" },
            "AZ_PNT": { "type": "integer" },
            "BITPIX": { "type": "integer" },
            "CHECKSUM": { "type": "string" },
            "COMMENT": { "type": "array", "items": { "type": "string" } },
            "CREATOR": { "type": "string" },
            "DAQ_ID": { "type": "string" },
            "DAQ_MODE": { "type": "string" },
            "DATAFORMAT": { "type": "string" },
            "DATALEVEL": { "type": "string" },
            "DATAMODE": { "type": "string" },
            "DATASUM": { "type": "string" },
            "DATE": { "type": "string", "format": "date-time" },
            "DATE-END": { "type": "string", "format": "date-time" },
            "DATE-OBS": { "type": "string", "format": "date-time" },
            "DEC_OBJ": { "type": "number" },
            "DEC_PNT": { "type": "number" },
            "EQUINOX": { "type": "string" },
            "EXTEND": { "type": "boolean" },
            "FILENAME": { "type": "string" },
            "FILEVERS": { "type": "integer" },
            "INSTRUME": { "type": "string" },
            "MJDREFF": { "type": "number" },
            "MJDREFI": { "type": "integer" },
            "NAXIS": { "type": "integer" },
            "NTEL": { "type": "integer" },
            "OBJECT": { "type": "string" },
            "OBS_DATE": { "type": "string", "format": "date" },
            "OBS_MODE": { "type": "string" },
            "ORIGIN": { "type": "string" },
            "ORIG_ID": { "type": "string" },
            "PROG_ID": { "type": "string" },
            "RADECSYS": { "type": "string" },
            "RA_OBJ": { "type": "number" },
            "RA_PNT": { "type": "number" },
            "RUN_ID": { "type": "string" },
            "SBL_ID": { "type": "string" },
            "SIMPLE": { "type": "boolean" },
            "SUBMODE": { "type": "string" },
            "TELAPSE": { "type": "string" },
            "TELESCOP": { "type": "string" },
            "TEL_ID": { "type": "string" },
            "TIMEOFFS": { "type": "integer" },
            "TIMESYS": { "type": "string" },
            "TIMEUNIT": { "type": "string" },
            "TSTART": { "type": "string" },
            "TSTOP": { "type": "string" }
          },
          "required": ["ALT_PNT", "AZ_PNT", "BITPIX", "CHECKSUM", "CREATOR", "DAQ_ID"]
        }
      },
      "required": ["Primary"]
    },
    "id": { "type": "string" },
    "infomail": { "type": "string" },
    "latest_version": { "type": "integer" },
    "object": { "type": "string" },
    "obsid": { "type": "integer" },
    "obsmode": { "type": "string" },
    "packtype": { "type": "string" },
    "programid": { "type": "integer" },
    "proposal": {
      "type": "object",
      "properties": {
        "carryover": { "type": "string" },
        "category": { "type": "string" },
        "cycle": {
          "type": "object",
          "properties": {
            "name": { "type": "string" },
            "period": { "type": "string" },
            "type": { "type": "string" }
          },
          "required": ["name", "period", "type"]
        },
        "obsprog": {
          "type": "object",
          "properties": {
            "arrayconf": {
              "type": "object",
              "properties": {
                "acq_mode": { "type": "string" },
                "acq_submode": { "type": "string" },
                "telmatrix": {
                  "type": "object",
                  "properties": {
                    "confname": { "type": "string" },
                    "on_off": { "type": "string" },
                    "type": { "type": "string" }
                  },
                  "required": ["confname", "on_off", "type"]
                },
                "trigger": { "type": "string" }
              },
              "required": ["acq_mode", "acq_submode", "telmatrix", "trigger"]
            },
            "constraints": {
              "type": "object",
              "properties": {
                "maxMIF": { "type": "string" },
                "maxZA": { "type": "string" },
                "minAT": { "type": "string" },
                "minET": { "type": "string" },
                "minMD": { "type": "string" },
                "minZA": { "type": "string" }
              },
              "required": ["maxMIF", "maxZA", "minAT", "minET", "minMD", "minZA"]
            },
            "progid": { "type": "string" },
            "target": {
              "type": "object",
              "properties": {
                "coord": { "type": "string" },
                "dec": { "type": "number" },
                "diameter": { "type": "string" },
                "epoch": { "type": "string" },
                "magnitude": { "type": "string" },
                "name": { "type": "string" },
                "rad": { "type": "number" },
                "tooflag": { "type": "string" },
                "type": { "type": "string" }
              },
              "required": ["coord", "dec", "diameter", "epoch", "magnitude", "name", "rad", "type"]
            }
          },
          "required": ["arrayconf", "constraints", "progid", "target"]
        },
        "piname": { "type": "string" },
        "propdate": { "type": "string" },
        "propid": { "type": "string" },
        "proplink": { "type": "string", "format": "uri" },
        "proptype": { "type": "string" },
        "reqtime": { "type": "string" }
      },
      "required": ["carryover", "category", "cycle", "obsprog", "piname", "propdate", "propid", "proplink", "proptype", "reqtime"]
    },
    "runid": { "type": "integer" },
    "schema": { "type": "string", "format": "uri" },
    "schemavers": { "type": "string" },
    "telescope": {
      "type": "object",
      "properties": {
        "altitude": { "type": "string" },
        "diamS1": { "type": "string" },
        "diamS2": { "type": "string" },
        "geo": {
          "type": "object",
          "properties": {
            "coord": { "type": "array", "items": { "type": "number" } },
            "type": { "type": "string" }
          },
          "required": ["coord", "type"]
        },
        "optconf": { "type": "string" },
        "telid": { "type": "string" },
        "telname": { "type": "string" },
        "type": { "type": "string" }
      },
      "required": ["altitude", "diamS1", "diamS2", "geo", "optconf", "telid", "telname", "type"]
    },
    "timestamp": { "type": "string", "format": "date-time" }
  },
  "required": [
    "aaid", "aipvers", "archive", "author", "camera", "daqmode", "datadesc", "datatype", "dateobs", "event", "file_version", "filename", "fsize", "header", "id", "infomail", "latest_version", "object", "obsid", "obsmode", "packtype", "programid",  "proposal", "runid", "schema", "schemavers", "telescope", "timestamp"
  ]
}