{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://torneo.ai/schemas/exit_acceptance.v1",
  "title": "exit_acceptance.v1",
  "description": "P-14: one round of the independent exit acceptance witnessed by an external, signing witness; a journaled human intervention fails the recette. Shape of the fields check_finalite reads; extra evidence fields are allowed. Dated, not synthetic and bound by sha256 to files of the repository (receipts/gates/<schema>/*.json).",
  "type": "object",
  "required": [
    "schema",
    "synthetic",
    "observed_on",
    "round",
    "witness",
    "steps",
    "recording_ref"
  ],
  "properties": {
    "schema": {
      "const": "exit_acceptance.v1"
    },
    "synthetic": {
      "type": "boolean",
      "description": "Only false counts (gate_common.read_receipts)."
    },
    "observed_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}"
    },
    "round": {
      "type": "integer",
      "minimum": 1
    },
    "witness": {
      "type": "object",
      "required": [
        "name",
        "organisation",
        "external",
        "signature"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "organisation": {
          "type": "string",
          "minLength": 1
        },
        "external": {
          "type": "boolean"
        },
        "signature": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "steps": {
      "type": "object",
      "required": [
        "third_party_organises",
        "buyer_decides",
        "agent_refuses_suspended"
      ],
      "properties": {
        "third_party_organises": {
          "type": "boolean"
        },
        "buyer_decides": {
          "type": "boolean"
        },
        "agent_refuses_suspended": {
          "type": "boolean"
        }
      }
    },
    "recording_ref": {
      "type": "object",
      "required": [
        "path",
        "sha256"
      ],
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "human_interventions": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "at": {
            "type": "string"
          },
          "who": {
            "type": "string"
          },
          "what": {
            "type": "string"
          }
        }
      }
    }
  }
}
