{
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "welcomeFile": { "type": "string", "minLength": 1 },
    "authenticationMethod": { "type": "string", "enum": ["none", "route"] },
    "stateProtection": { "type": "boolean" },
    "sessionTimeout": { "type": "integer", "minimum": 1 },
    "pluginMetadataEndpoint": { "type": "string", "minLength": 1, "format": "relative-uri" },
    "routes": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "format": "route-rules",
        "properties": {
          "source": { "$ref": "sourceSchema" },
          "httpMethods": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "string",
              "enum": ["DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE", "PATCH"]
            }
          },
          "target": { "type": "string", "minLength": 1, "format": "relative-uri" },
          "destination": { "type": "string", "minLength": 1 },
          "setBackendSessionCookies": { "type": "boolean" },
          "localDir": { "type": "string", "minLength": 1 },
          "csrfProtection": { "type": "boolean" },
          "preferLocal": {"type": "boolean"},
          "service": { "type": "string" },
          "endpoint": { "type": "string" },
          "authenticationType": { "type": "string", "enum": ["xsuaa", "ias","basic", "none"] },
          "identityProvider": { "type": "string", "minLength": 1},
          "dynamicIdentityProvider": { "type": "boolean" },
          "scope": { "$ref": "scopesSchema" },
          "replace": {
            "type": "object",
            "required": ["pathSuffixes"],
            "additionalProperties": false,
            "properties": {
              "pathSuffixes": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "format": "relative-uri"
                }
              },
              "vars": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "services": {
                "type": "object"
              }
            }
          },
          "cacheControl": { "type": "string", "minLength": 1, "format": "valid-header-value" }
        },
        "required": ["source"]
      }
    },
    "responseHeaders": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "format": "headers-rules"
          },
          "value": {
            "type": "string",
            "minLength": 1,
            "format": "valid-header-value"
          }
        },
        "required": ["name", "value"]
      }
    },
    "destinations": {
      "type": "object",
      "format": "destinations-rules",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "logoutPath": { "type": "string", "minLength": 1, "format": "relative-uri" },
          "logoutMethod": { "type": "string", "enum": ["PUT", "POST", "GET"] }
        }
      }
    },
    "services": {
      "type": "object",
      "format": "services-rules",
      "additionalProperties": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "endpoint": { "type": "string", "minLength": 1},
          "logoutPath": { "type": "string", "minLength": 1, "format": "relative-uri" },
          "logoutMethod": { "type": "string", "enum": ["PUT", "POST", "GET"] }
        }
      }
    },
    "logout": {
      "type": "object",
      "additionalProperties": false,
      "format": "logout-rules",
      "properties": {
        "backChannelLogoutEndpoint": { "type": "string", "minLength": 1, "format": "relative-uri" },
        "logoutEndpoint": { "type": "string", "minLength": 1, "format": "relative-uri" },
        "logoutPage": { "type": "string", "minLength": 1, "format": "uri" },
        "logoutMethod": { "type": "string", "enum": ["POST", "GET"] },
        "csrfProtection": {"type": "boolean"}
      }
    },
    "login": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "callbackEndpoint": { "type": "string", "minLength": 1, "format": "relative-uri" }
      },
      "required": ["callbackEndpoint"]
    },
    "whitelistService": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "endpoint": { "type": "string", "minLength": 1, "format": "relative-uri" }
      },
      "required": ["endpoint"]
    },
    "compression": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": { "type": "boolean" },
        "minSize": { "type": "integer", "minimum": 1 },
        "compressResponseMixedTypeContent": { "type": "boolean" }
      }
    },
    "websockets": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "enabled": { "type": "boolean" }
      },
      "required": ["enabled"]
    },
    "errorPage": {
      "type": "array",
      "additionalProperties": false,
      "items": {
        "type": "object",
        "required": ["status"],
        "oneOf": [
          { "required": ["file"] },
          { "required": ["path"] }
        ],
        "properties": {
          "status": {
            "type": ["integer", "array"],
            "minimum": 1,
            "minItems": 1,
            "uniqueItems": true,
            "items": { "type": "integer", "minimum": 1 }
          },
          "file": { "type": "string", "minLength": 1, "format": "local-file" },
          "path": { "type": "string", "minLength": 1, "format": "relative-uri" }
        }
      }
    },
    "cors": { "$ref": "corsSchema" }
  },
  "required": ["sessionTimeout"]
}