{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "definitions": {
    "bidwarBias": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "bidId": {
          "type": "number",
          "default": 0,
          "$comment": "ID of relevant bid in the tracker."
        },
        "option1Id": {
          "type": "number",
          "default": 0,
          "$comment": "ID of option of team 1 in the tracker on the above bid."
        },
        "option2Id": {
          "type": "number",
          "default": 0,
          "$comment": "ID of option of team 2 in the tracker on the above bid."
        },
        "optionTitle": {
          "type": "string",
          "default": "Commentary Bias",
          "$comment": "String to be used on layout to describe the visual bar."
        }
      },
      "required": [
        "bidId",
        "option1Id",
        "option2Id",
        "optionTitle"
      ]
    }
  },
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "useTestData": {
      "type": "boolean",
      "default": false
    },
    "event": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "theme": {
          "$comment": "Theme to be used in the graphical overlays; will use default if none supplied.",
          "type": "string"
        },
        "shorts": {
          "$comment": "This/these must match the tracker, if that feature is enabled.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              },
              "uniqueItems": true,
              "minItems": 1,
              "maxItems": 2
            }
          ],
          "default": "EVENT_SHORT"
        },
        "thisEvent": {
          "$comment": "If the 'event' has multiple tracker events, this a 1-indexed value of which one is applicable to this stream from the shorts array.",
          "type": "number",
          "minimum": 1,
          "maximum": 2,
          "default": 1
        },
        "online": {
          "$comment": "If this event is ran online and has no on-site presence.",
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "$comment": "If set to 'partial', will only do basic changes.",
              "type": "string",
              "enum": [
                "partial",
                "full"
              ]
            }
          ],
          "default": false
        },
        "fallbackTwitchTitle": {
          "$comment": "Set the fallback Twitch title for this event; {{total}} and {{run}} can be used as placeholders (see source code).",
          "type": "string"
        },
        "currency": {
          "$comment": "Overrides for the currency symbol and country code used in various graphics",
          "additionalProperties": false,
          "properties": {
            "symbol": {
              "$comment": "The currency symbol (defaults to $)",
              "type": "string",
              "default": "$"
            },
            "countryCode": {
              "$comment": "The country code (defaults to en-US)",
              "type": "string",
              "default": "en-US"
            }
          }
        }
      },
      "required": [
        "shorts",
        "thisEvent",
        "online"
      ]
    },
    "omnibar": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "miniCredits": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "header": {
              "type": "string",
              "default": "Thanks to all these people!"
            },
            "screeners": {
              "type": "string"
            },
            "tech": {
              "type": "string"
            }
          },
          "required": [
            "header"
          ]
        }
      },
      "required": [
        "miniCredits"
      ]
    },
    "streamdeck": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "port": {
          "type": "number",
          "default": 9091
        },
        "key": {
          "type": "string",
          "default": "DEFAULT_KEY"
        },
        "debug": {
          "type": "boolean",
          "default": false
        }
      },
      "required": [
        "enabled",
        "port",
        "key",
        "debug"
      ]
    },
    "rabbitmq": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "protocol": {
          "type": "string",
          "default": "amqps"
        },
        "hostname": {
          "type": "string",
          "default": "mq.esamarathon.com"
        },
        "username": {
          "type": "string",
          "default": "USERNAME"
        },
        "password": {
          "type": "string",
          "default": "PASSWORD"
        },
        "vhost": {
          "type": "string",
          "default": "esa_prod"
        },
        "queuePrepend": {
          "type": "string"
        }
      },
      "required": [
        "enabled",
        "protocol",
        "hostname",
        "username",
        "password",
        "vhost"
      ]
    },
    "obs": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "address": {
          "type": "string",
          "default": "localhost:4444"
        },
        "password": {
          "type": "string",
          "default": ""
        },
        "canvasResolution": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "width": {
              "type": "number",
              "default": 1920
            },
            "height": {
              "type": "number",
              "default": 1080
            }
          },
          "required": [
            "width",
            "height"
          ]
        },
        "names": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "scenes": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "commercials": {
                  "type": "string",
                  "default": "Intermission (commercials)"
                },
                "gameLayout": {
                  "type": "string",
                  "default": "Game Layout"
                },
                "readerIntroduction": {
                  "type": "string",
                  "default": "Reader Introduction"
                },
                "intermission": {
                  "type": "string",
                  "default": "Intermission"
                },
                "intermissionPlayer": {
                  "type": "string",
                  "default": "Intermission Player"
                },
                "countdown": {
                  "type": "string",
                  "default": "Countdown"
                }
              },
              "required": [
                "commercials",
                "gameLayout",
                "readerIntroduction",
                "intermission",
                "intermissionPlayer",
                "countdown"
              ]
            },
            "sources": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "gameSources": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "uniqueItems": true,
                      "minItems": 1
                    }
                  ],
                  "default": "Game Source"
                },
                "cameraSources": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "uniqueItems": true,
                      "minItems": 1
                    }
                  ],
                  "default": "Camera Source"
                },
                "cameraSourceCrowd": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "twitchSources": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "uniqueItems": true,
                      "minItems": 1,
                      "maxItems": 2
                    }
                  ],
                  "default": "Twitch Source"
                },
                "videoPlayer": {
                  "type": "string",
                  "default": "Video Player Source"
                },
                "donationSound": {
                  "type": "string",
                  "default": "Donation Sound"
                }
              },
              "required": [
                "gameSources",
                "cameraSources",
                "twitchSources",
                "videoPlayer",
                "donationSound"
              ]
            },
            "groups": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "gameCaptures": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "uniqueItems": true,
                      "minItems": 1
                    }
                  ],
                  "default": "Game Capture"
                },
                "cameraCaptures": {
                  "oneOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "uniqueItems": true,
                      "minItems": 1
                    }
                  ],
                  "default": "Camera Capture"
                }
              },
              "required": [
                "gameCaptures",
                "cameraCaptures"
              ]
            }
          },
          "required": [
            "scenes",
            "sources",
            "groups"
          ]
        }
      },
      "required": [
        "enabled",
        "address",
        "password",
        "canvasResolution",
        "names"
      ]
    },
    "music": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "address": {
          "type": "string",
          "default": "localhost:8880"
        },
        "username": {
          "type": "string",
          "default": ""
        },
        "password": {
          "type": "string",
          "default": ""
        }
      },
      "required": [
        "enabled",
        "address",
        "username",
        "password"
      ]
    },
    "x32": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "ip": {
          "type": "string",
          "default": "10.20.30.42"
        },
        "localPort": {
          "type": "number",
          "default": 52361
        },
        "xr18": {
          "type": "boolean",
          "default": false
        }
      },
      "required": [
        "enabled",
        "ip",
        "localPort",
        "xr18"
      ]
    },
    "xkeys": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        }
      },
      "required": [
        "enabled"
      ]
    },
    "tracker": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "address": {
          "type": "string",
          "default": "donations.esamarathon.com"
        },
        "username": {
          "type": "string",
          "default": "USERNAME"
        },
        "password": {
          "type": "string",
          "default": "PASSWORD"
        },
        "prizesUrl": {
          "type": "string",
          "default": "prizes.esamarathon.com"
        },
        "commentaryBias": {
          "$ref": "#/definitions/bidwarBias"
        },
        "otherBidwarBias": {
          "$ref": "#/definitions/bidwarBias"
        },
        "donationTotalInTitle": {
          "type": "boolean",
          "default": true
        }
      },
      "required": [
        "enabled",
        "address",
        "username",
        "password",
        "prizesUrl",
        "commentaryBias",
        "otherBidwarBias",
        "donationTotalInTitle"
      ]
    },
    "tts": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "voiceAPI": {
          "type": "string",
          "default": "URL"
        },
        "key": {
          "type": "string",
          "default": "TOKEN"
        }
      },
      "required": [
        "enabled",
        "voiceAPI",
        "key"
      ]
    },
    "flagcarrier": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        },
        "allowedDevices": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              },
              "uniqueItems": true,
              "minItems": 1
            },
            {
              "type": "null"
            }
          ]
        },
        "group": {
          "type": "string",
          "default": "stream1"
        },
        "availableButtons": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name"
            ]
          },
          "default": [
            {
              "id": "1",
              "name": "PC 1"
            },
            {
              "id": "2",
              "name": "PC 2"
            },
            {
              "id": "3",
              "name": "Console 1"
            },
            {
              "id": "4",
              "name": "Console 2"
            }
          ]
        }
      },
      "required": [
        "enabled",
        "group",
        "availableButtons"
      ]
    },
    "offsite": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "address": {
          "type": "string",
          "default": "https://app.esamarathon.com/offsite/api"
        },
        "key": {
          "type": "string",
          "default": "SECRET_KEY"
        }
      },
      "required": [
        "enabled",
        "address",
        "key"
      ]
    },
    "server": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "address": {
          "type": "string",
          "default": "https://register.esamarathon.com/api"
        },
        "key": {
          "type": "string",
          "default": "SECRET_KEY"
        }
      },
      "required": [
        "enabled",
        "address",
        "key"
      ]
    },
    "discord": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "token": {
          "type": "string",
          "default": "BOT_TOKEN"
        },
        "textChannelId": {
          "type": "string",
          "default": "TEXT_CHANNEL_ID"
        }
      },
      "required": [
        "enabled",
        "token",
        "textChannelId"
      ]
    },
    "streamlabsCharity": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "apiUrl": {
          "type": "string",
          "default": "API_URL"
        }
      },
      "required": [
        "enabled",
        "apiUrl"
      ]
    },
    "therungg": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": true
        }
      },
      "required": [
        "enabled"
      ]
    }
  },
  "required": [
    "useTestData",
    "event",
    "omnibar",
    "streamdeck",
    "rabbitmq",
    "obs",
    "music",
    "x32",
    "xkeys",
    "tracker",
    "tts",
    "flagcarrier",
    "offsite",
    "server",
    "discord",
    "streamlabsCharity",
    "therungg"
  ]
}