{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.dockfm.it/open-radio-standard/schema/0.1.json",
  "title": "Open Radio Standard 0.1",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "version",
    "station",
    "streams"
  ],
  "properties": {
    "version": {
      "const": "0.1"
    },
    "station": {
      "type": "object",
      "required": [
        "name",
        "website"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "maxLength": 120
        },
        "website": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "logo": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "country": {
          "type": "string",
          "maxLength": 2
        }
      },
      "additionalProperties": true
    },
    "streams": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "url"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "format": {
            "type": "string"
          },
          "bitrate": {
            "type": "integer",
            "minimum": 1
          },
          "label": {
            "type": "string"
          },
          "role": {
            "type": "string",
            "enum": [
              "primary",
              "fallback",
              "low-latency",
              "archive"
            ]
          },
          "priority": {
            "type": "integer",
            "minimum": 1
          }
        },
        "additionalProperties": true
      }
    },
    "nowPlaying": {
      "type": "object",
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      },
      "additionalProperties": true
    },
    "schedule": {
      "type": "object",
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      },
      "additionalProperties": true
    },
    "contact": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        }
      },
      "additionalProperties": true
    },
    "capabilities": {
      "type": "object",
      "properties": {
        "nowPlaying": {
          "type": "boolean"
        },
        "schedule": {
          "type": "boolean"
        },
        "artwork": {
          "type": "boolean"
        },
        "fallbackStream": {
          "type": "boolean"
        },
        "lowLatency": {
          "type": "boolean"
        },
        "archive": {
          "type": "boolean"
        },
        "liveState": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "live": {
      "type": "object",
      "properties": {
        "endpoint": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "pollSeconds": {
          "type": "integer",
          "minimum": 5,
          "maximum": 300
        }
      },
      "additionalProperties": true
    }
  }
}