{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://8.218.89.247:8788/esia-db/v1/schema/esia_regulation_schema_v1.json",
  "title": "GlobalESIA V1.0 Regulatory & Quantitative Limit Schema",
  "type": "object",
  "required": [
    "db_version",
    "architecture",
    "records"
  ],
  "properties": {
    "db_version": {
      "type": "string"
    },
    "architecture": {
      "type": "object",
      "required": [
        "local_zero_upload",
        "hk_sync_endpoint"
      ],
      "properties": {
        "local_zero_upload": {
          "type": "boolean",
          "const": true
        },
        "hk_sync_endpoint": {
          "type": "string"
        }
      }
    },
    "records": {
      "type": "object"
    }
  },
  "$defs": {
    "limit_entry": {
      "type": "object",
      "required": [
        "parameter",
        "medium",
        "unit",
        "averaging_period",
        "source_standard",
        "source_url"
      ],
      "properties": {
        "parameter": {
          "type": "string"
        },
        "medium": {
          "enum": [
            "effluent",
            "air_stack",
            "ambient_air",
            "noise",
            "emf"
          ]
        },
        "value": {
          "type": [
            "number",
            "null"
          ]
        },
        "min_value": {
          "type": [
            "number",
            "null"
          ]
        },
        "max_value": {
          "type": [
            "number",
            "null"
          ]
        },
        "unit": {
          "type": "string"
        },
        "speciation": {
          "type": "string"
        },
        "averaging_period": {
          "type": "string"
        },
        "ref_temp_K": {
          "type": [
            "number",
            "null"
          ]
        },
        "ref_pressure_kPa": {
          "type": [
            "number",
            "null"
          ]
        },
        "dry_gas": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "ref_O2_pct": {
          "type": [
            "number",
            "null"
          ]
        },
        "excess_air_alpha": {
          "type": [
            "number",
            "null"
          ]
        },
        "airshed_class": {
          "enum": [
            "ALL",
            "NDA",
            "DA",
            "KEY_REGION"
          ]
        },
        "receiving_water_type": {
          "enum": [
            "ALL",
            "FRESHWATER",
            "MARINE",
            "UPSTREAM_INTAKE",
            "INLAND_OTHER"
          ]
        },
        "source_standard": {
          "type": "string"
        },
        "effective_date": {
          "type": "string"
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "notes": {
          "type": "string"
        }
      }
    }
  }
}