{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "BackfocusLab normalized plan",
  "$id": "https://backfocuslab.com/schemas/plan.schema.json",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "product",
    "version",
    "fields",
    "tables",
    "demo"
  ],
  "properties": {
    "product": {
      "const": "astronomy-equipment-compatibility"
    },
    "version": {
      "const": 1
    },
    "demo": {
      "type": "boolean"
    },
    "fields": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "focal",
        "aperture",
        "reducer",
        "seeing",
        "pixel",
        "sensorWidth",
        "sensorHeight",
        "imageCircle",
        "backfocus",
        "tolerance",
        "filterCorrection",
        "filterThickness",
        "index"
      ],
      "properties": {
        "focal": {
          "type": "number",
          "minimum": 1,
          "maximum": 50000,
          "description": "Telescope focal length (mm)"
        },
        "aperture": {
          "type": "number",
          "minimum": 1,
          "maximum": 5000,
          "description": "Telescope aperture (mm)"
        },
        "reducer": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 10,
          "description": "Reducer / Barlow factor (×)"
        },
        "seeing": {
          "type": "number",
          "minimum": 0.5,
          "maximum": 10,
          "description": "Typical local seeing (″)"
        },
        "pixel": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 20,
          "description": "Pixel size (µm)"
        },
        "sensorWidth": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 100,
          "description": "Sensor width (mm)"
        },
        "sensorHeight": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 100,
          "description": "Sensor height (mm)"
        },
        "imageCircle": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 200,
          "description": "Published image circle (mm)"
        },
        "backfocus": {
          "type": "number",
          "minimum": 0.1,
          "maximum": 500,
          "description": "Required sensor distance (mm)"
        },
        "tolerance": {
          "type": "number",
          "minimum": 0,
          "maximum": 10,
          "description": "Spacing tolerance (mm)"
        },
        "filterCorrection": {
          "type": "string",
          "enum": [
            "Yes",
            "No"
          ]
        },
        "filterThickness": {
          "type": "number",
          "minimum": 0,
          "maximum": 20,
          "description": "Filter glass thickness (mm)"
        },
        "index": {
          "type": "number",
          "minimum": 1,
          "maximum": 3,
          "description": "Glass refractive index"
        }
      }
    },
    "tables": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "train"
      ],
      "properties": {
        "train": {
          "type": "array",
          "maxItems": 10000,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "length",
              "input",
              "output",
              "source"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20000
              },
              "length": {
                "type": "number",
                "minimum": 0,
                "maximum": 500
              },
              "input": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20000
              },
              "output": {
                "type": "string",
                "minLength": 1,
                "maxLength": 20000
              },
              "source": {
                "type": "string",
                "maxLength": 20000,
                "pattern": "^(?:https?://(?:\\[[0-9a-fA-F:.]+\\]|[^:@\\s/?#]+)(?::(?:[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?(?:[/?#][^\\s]*)?)?$",
                "description": "Empty, or an HTTP(S) URL without credentials; never fetched by the calculator."
              }
            }
          }
        }
      }
    }
  }
}
