{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://app.broadcastwell.com/channel-requirements.schema.json",
  "title": "Channel requirements catalogue",
  "type": "object",
  "required": [
    "version",
    "checked_on",
    "directories"
  ],
  "properties": {
    "version": {
      "type": "string"
    },
    "checked_on": {
      "type": "string",
      "format": "date"
    },
    "directories": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/directory"
      }
    }
  },
  "$defs": {
    "directory": {
      "type": "object",
      "required": [
        "id",
        "name",
        "kind",
        "source",
        "checked_on",
        "primary_confirmed",
        "requirements",
        "depends_on"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$"
        },
        "name": {
          "type": "string"
        },
        "kind": {
          "type": "string"
        },
        "operator": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "checked_on": {
          "type": "string",
          "format": "date"
        },
        "primary_confirmed": {
          "type": "boolean"
        },
        "status_note": {
          "type": "string"
        },
        "requirements": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "text"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "text": {
                "type": "string",
                "maxLength": 300
              }
            }
          }
        },
        "depends_on": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "channels": {
      "type": "object",
      "required": [
        "checked_on",
        "channels"
      ],
      "properties": {
        "checked_on": {
          "type": "string",
          "format": "date"
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "kind",
              "name",
              "url",
              "checked_on"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "kind": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "pattern": "^https://"
              },
              "checked_on": {
                "type": "string",
                "format": "date"
              }
            }
          }
        }
      }
    }
  }
}
