{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://forms.takoform.com/schemas/v1alpha2/host-discovery.schema.json",
  "title": "Takoform current host discovery v1alpha2",
  "type": "object",
  "required": ["api_versions", "features", "endpoints"],
  "properties": {
    "api_versions": {
      "type": "array",
      "const": ["forms.takoform.com/v1alpha2"]
    },
    "features": {
      "type": "object",
      "required": ["service_forms", "exact_form_ref", "optimistic_concurrency", "idempotent_lifecycle"],
      "properties": {
        "service_forms": {
          "const": true
        },
        "exact_form_ref": {
          "const": true
        },
        "optimistic_concurrency": {
          "const": true
        },
        "idempotent_lifecycle": {
          "const": true
        }
      },
      "additionalProperties": {
        "type": "boolean"
      }
    },
    "endpoints": {
      "type": "object",
      "required": ["api"],
      "properties": {
        "api": {
          "allOf": [
            {
              "$ref": "#/$defs/httpEndpoint"
            },
            {
              "pattern": "^https?://[^/?#]+/apis/forms\\.takoform\\.com/v1alpha2$"
            }
          ]
        },
        "forms": {
          "allOf": [
            {
              "$ref": "#/$defs/httpEndpoint"
            },
            {
              "pattern": "^https?://[^/?#]+/apis/forms\\.takoform\\.com/v1alpha2/forms$"
            }
          ],
          "x-takoform-sameOriginWith": "/endpoints/api"
        },
        "interfaces": {
          "allOf": [
            {
              "$ref": "#/$defs/httpEndpoint"
            },
            {
              "pattern": "^https?://[^/?#]+/apis/forms\\.takoform\\.com/v1alpha2/interfaces$"
            }
          ],
          "x-takoform-sameOriginWith": "/endpoints/api"
        },
        "oidc_issuer": {
          "allOf": [
            {
              "$ref": "#/$defs/httpEndpoint"
            },
            {
              "pattern": "^https://"
            }
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$defs": {
    "httpEndpoint": {
      "type": "string",
      "format": "uri",
      "pattern": "^https?://",
      "allOf": [
        {
          "not": {
            "pattern": "^https?://[^/?#]*@"
          }
        },
        {
          "not": {
            "pattern": "[?#]"
          }
        }
      ]
    }
  }
}
