{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://torneo.ai/schemas/organiser_session.v1",
  "title": "organiser_session.v1",
  "description": "P-2: one session of an external organisation running the 8-step organiser journey (10 sessions, 9 without intervention, one second use). 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",
    "organisation",
    "steps",
    "recording_ref"
  ],
  "properties": {
    "schema": {
      "const": "organiser_session.v1"
    },
    "synthetic": {
      "type": "boolean",
      "description": "Only false counts (gate_common.read_receipts)."
    },
    "observed_on": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}"
    },
    "organisation": {
      "type": "object",
      "required": [
        "name",
        "external"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1
        },
        "controle_ultime": {
          "type": "string"
        },
        "external": {
          "type": "boolean"
        }
      }
    },
    "steps": {
      "type": "array",
      "minItems": 8,
      "maxItems": 8,
      "items": {
        "type": "object",
        "required": [
          "done"
        ],
        "properties": {
          "done": {
            "type": "boolean"
          }
        }
      }
    },
    "use": {
      "type": "integer",
      "minimum": 1
    },
    "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"
          }
        }
      }
    }
  }
}
