{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://er-repo.staging.strongroom.ai/schemas/backend-profiles.schema.json",
  "title": "Backend Profiles",
  "description": "Configuration for backend profiles used by clients to connect to backend servers",
  "type": "object",
  "properties": {
    "version": {
      "type": "string",
      "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)$"
    },
    "backendProfiles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "serverGroup": {
            "type": "string"
          },
          "profileId": {
            "type": "string",
            "pattern": "^(prod|staging|dev)-(au|us|eu)-(direct|proxy[0-9]+)$"
          },
          "applicationGatewayUrl": {
            "type": "string",
            "format": "uri"
          },
          "apiGatewayUrl": {
            "type": "string",
            "format": "uri"
          },
          "apiGatewayV1Url": {
            "type": "string",
            "format": "uri"
          },
          "integrationRpcUrl": {
            "type": "string",
            "format": "uri"
          },
          "oauth": {
            "type": "object",
            "properties": {
              "accessTokenUrl": {
                "type": "string",
                "format": "uri"
              },
              "authorizationUrl": {
                "type": "string",
                "format": "uri"
              },
              "clientId": {
                "type": "string",
                "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
              },
              "redirectUrl": {
                "type": "string",
                "format": "uri"
              },
              "scope": {
                "type": "string"
              }
            },
            "required": [
              "accessTokenUrl",
              "authorizationUrl",
              "clientId",
              "redirectUrl"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "serverGroup",
          "profileId",
          "applicationGatewayUrl",
          "integrationRpcUrl"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "version",
    "backendProfiles"
  ],
  "patternProperties": {
    "^\\$": {
      "type": "string"
    }
  },
  "additionalProperties": false
}