{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Controller+ connection manifest v1",
  "type": "object",
  "required": [
    "v",
    "routes",
    "policy"
  ],
  "properties": {
    "v": {
      "const": 1
    },
    "game": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    },
    "routes": {
      "type": "array",
      "minItems": 1,
      "maxItems": 12,
      "items": {
        "type": "object",
        "required": [
          "id",
          "transport",
          "scope",
          "codec"
        ],
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 64
          },
          "transport": {
            "anyOf": [
              {
                "enum": [
                  "websocket",
                  "webrtc",
                  "native-udp",
                  "native-tcp"
                ]
              },
              {
                "type": "string",
                "pattern": "^x-[a-z0-9][a-z0-9.-]{1,30}$"
              }
            ]
          },
          "scope": {
            "enum": [
              "developer",
              "local",
              "peer",
              "relay"
            ]
          },
          "endpoint": {
            "type": "string",
            "format": "uri"
          },
          "codec": {
            "type": "string"
          },
          "priority": {
            "type": "number"
          },
          "timeout": {
            "type": "number",
            "minimum": 500,
            "maximum": 15000
          },
          "iceServers": {
            "type": "array"
          }
        }
      }
    },
    "policy": {
      "type": "object",
      "properties": {
        "allowOurRelay": {
          "type": "boolean"
        },
        "desktopControl": {
          "type": "boolean"
        }
      }
    },
    "requiredCapabilities": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "optionalCapabilities": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "controls": {
      "type": "object"
    }
  }
}
