{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/anchord-ai/json-schema/anchord-ai-guard-write-response-schema.json",
  "title": "GuardWriteResponse",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/anchord-ai-openapi.yaml#/components/schemas/GuardWriteResponse",
  "type": "object",
  "required": [
    "audit_id",
    "allowed",
    "blocks",
    "request_id"
  ],
  "properties": {
    "audit_id": {
      "type": "string",
      "format": "uuid"
    },
    "allowed": {
      "type": "boolean"
    },
    "entity_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The entity that was evaluated."
    },
    "entity": {
      "anyOf": [
        {
          "$ref": "#/$defs/EntityRef"
        },
        {
          "type": "null"
        }
      ]
    },
    "blocks": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Block codes when allowed is false. Possible values: ENTITY_NOT_FOUND, NO_CANONICAL_LINK, CONFIDENCE_BELOW_THRESHOLD, UNRESOLVED_CONFLICTS.\n"
    },
    "confidence": {
      "type": [
        "number",
        "null"
      ],
      "minimum": 0,
      "maximum": 1
    },
    "active_links": {
      "type": "integer",
      "description": "Count of active entity links at evaluation time."
    },
    "redirect": {
      "description": "Present when the requested entity has been merged. Evaluation was performed against the canonical entity.",
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "enum": [
            "ENTITY_REDIRECTED_TO_CANONICAL"
          ]
        },
        "requested_entity_id": {
          "type": "string",
          "format": "uuid"
        },
        "canonical_entity_id": {
          "type": "string",
          "format": "uuid"
        }
      }
    },
    "request_id": {
      "type": "string"
    }
  },
  "$defs": {
    "EntityKind": {
      "type": "string",
      "enum": [
        "company",
        "person"
      ]
    },
    "EntityRef": {
      "type": "object",
      "required": [
        "id",
        "kind"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "kind": {
          "$ref": "#/$defs/EntityKind"
        }
      }
    }
  }
}