{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/klisten-co-kr/json-schema/klisten-co-kr-clear-gate-result-schema.json",
  "title": "ClearGateResult",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/klisten-co-kr-cleargate-api-openapi.yml#/components/schemas/ClearGateResult",
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string"
        },
        "evaluated_scope": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "publisher_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "resource": {
                  "type": "string",
                  "maxLength": 2048,
                  "format": "uri"
                },
                "audience": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "purpose": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "territory": {
                  "type": "string",
                  "pattern": "^[A-Z]{2}$"
                },
                "redistribute": {
                  "type": "boolean"
                },
                "org_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "required": [
                "publisher_id",
                "resource",
                "audience",
                "purpose",
                "territory",
                "redistribute",
                "org_id"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "evaluated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "executed": {
          "type": "boolean",
          "const": false
        },
        "fetch_requires_ssrf_checks": {
          "type": "boolean",
          "const": true
        },
        "status": {
          "type": "string",
          "const": "DENIED"
        },
        "grant_id": {
          "type": "null"
        }
      },
      "required": [
        "reason",
        "evaluated_scope",
        "evaluated_at",
        "executed",
        "fetch_requires_ssrf_checks",
        "status",
        "grant_id"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string",
          "const": "VERIFIED_GRANT_MATCH"
        },
        "evaluated_scope": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "publisher_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "resource": {
                  "type": "string",
                  "maxLength": 2048,
                  "format": "uri"
                },
                "audience": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "purpose": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                },
                "territory": {
                  "type": "string",
                  "pattern": "^[A-Z]{2}$"
                },
                "redistribute": {
                  "type": "boolean"
                },
                "org_id": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 128
                }
              },
              "required": [
                "publisher_id",
                "resource",
                "audience",
                "purpose",
                "territory",
                "redistribute",
                "org_id"
              ],
              "additionalProperties": false
            },
            {
              "type": "null"
            }
          ]
        },
        "evaluated_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        },
        "executed": {
          "type": "boolean",
          "const": false
        },
        "fetch_requires_ssrf_checks": {
          "type": "boolean",
          "const": true
        },
        "status": {
          "type": "string",
          "const": "AUTHORIZED"
        },
        "grant_id": {
          "type": "string"
        },
        "grant_evidence_digest": {
          "type": "string",
          "pattern": "^sha256:[a-f0-9]{64}$"
        },
        "expires_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        "scope": {
          "type": "object",
          "properties": {
            "resource": {
              "type": "string",
              "maxLength": 2048,
              "format": "uri"
            },
            "purpose": {
              "type": "string",
              "minLength": 1,
              "maxLength": 128
            },
            "territory": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            },
            "redistribute": {
              "type": "boolean"
            }
          },
          "required": [
            "resource",
            "purpose",
            "territory",
            "redistribute"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "reason",
        "evaluated_scope",
        "evaluated_at",
        "executed",
        "fetch_requires_ssrf_checks",
        "status",
        "grant_id",
        "grant_evidence_digest",
        "expires_at",
        "scope"
      ],
      "additionalProperties": false
    }
  ]
}