{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://www.anguskit.com/schema/angusmeter/plugins/angus-soap.json",
  "type": "object",
  "properties": {
    "endpoint": {
      "type": "string",
      "description": "SOAP web service endpoint URL"
    },
    "soapAction": {
      "type": "string",
      "description": "SOAPAction header value (SOAP 1.1) or action parameter (SOAP 1.2)",
      "default": ""
    },
    "soapVersion": {
      "type": "string",
      "enum": [
        "1.1",
        "1.2"
      ],
      "default": "1.1",
      "description": "SOAP protocol version"
    },
    "body": {
      "type": "string",
      "description": "SOAP XML envelope body (supports ${var} interpolation)"
    },
    "headers": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "description": "Additional HTTP headers as key-value pairs"
    },
    "username": {
      "type": "string",
      "description": "HTTP Basic authentication username"
    },
    "password": {
      "type": "string",
      "description": "HTTP Basic authentication password",
      "writeOnly": true
    },
    "timeout": {
      "type": "integer",
      "minimum": 1,
      "default": 30000,
      "description": "Request timeout in ms"
    },
    "connectTimeout": {
      "type": "integer",
      "minimum": 1,
      "default": 10000,
      "description": "Connection timeout in ms"
    },
    "trustAllCerts": {
      "type": "boolean",
      "default": false,
      "description": "Trust all SSL certificates (test environments only)"
    },
    "followRedirects": {
      "type": "boolean",
      "default": true,
      "description": "Follow HTTP redirects"
    },
    "assertions": {
      "type": "array",
      "description": "Optional step-level assertions against the SOAP HTTP response (see SoapConfigValidator). BODY is an alias for RESPONSE_BODY.",
      "items": {
        "$ref": "#/definitions/soapAssertion"
      }
    },
    "extractors": {
      "type": "array",
      "description": "Optional extractors from the SOAP response (see SoapConfigValidator).",
      "items": {
        "$ref": "#/definitions/soapExtractor"
      }
    }
  },
  "required": [
    "endpoint",
    "body"
  ],
  "definitions": {
    "soapAssertion": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "STATUS_CODE",
            "RESPONSE_TIME",
            "BODY_CONTAINS",
            "BODY_EQUALS",
            "BODY_JSON_PATH",
            "BODY_REGEX",
            "BODY_XPATH",
            "BODY_SIZE",
            "HEADER_EXISTS",
            "HEADER_VALUE",
            "NOT_NULL",
            "CUSTOM",
            "RESPONSE_BODY",
            "BODY"
          ]
        },
        "operator": {
          "type": "string",
          "enum": [
            "EQUALS",
            "NOT_EQUALS",
            "CONTAINS",
            "NOT_CONTAINS",
            "GREATER_THAN",
            "LESS_THAN",
            "GREATER_OR_EQUAL",
            "LESS_OR_EQUAL",
            "MATCHES_REGEX"
          ]
        },
        "expected": {
          "description": "Expected value for the assertion"
        },
        "expression": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        }
      },
      "required": [
        "type"
      ]
    },
    "soapExtractor": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "JSON_PATH",
            "REGEX",
            "RESPONSE_CODE",
            "RESPONSE_TIME"
          ]
        },
        "expression": {
          "type": "string"
        },
        "variable": {
          "type": "string"
        },
        "defaultValue": {
          "type": "string"
        }
      },
      "required": [
        "type",
        "variable"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "type": {
                "enum": [
                  "JSON_PATH",
                  "REGEX"
                ]
              }
            }
          },
          "then": {
            "required": [
              "expression"
            ]
          }
        }
      ]
    }
  }
}
