{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.elimi.africa/contracts/events/cohort.seat_consumed.v1.json",
  "title": "cohort.seat_consumed data",
  "description": "data payload for cohort.seat_consumed. Emitted by CAP (applicationId) or LMS (levelEnrollmentId) when bulk enrol consumes one cohort slot. Orchestrator may project a CohortSeat row. Idempotent on the envelope eventId; the active consume is unique per lineItemId + userId. Exactly one of applicationId or levelEnrollmentId is set.",
  "type": "object",
  "additionalProperties": false,
  "required": ["cohortId", "lineItemId", "userId"],
  "properties": {
    "cohortId": {
      "type": "string",
      "minLength": 1
    },
    "lineItemId": {
      "type": "string",
      "minLength": 1,
      "description": "CohortLineItem.id from cohort.activated"
    },
    "userId": {
      "type": "string",
      "minLength": 1,
      "description": "Orchestrator User.id of the learner or candidate"
    },
    "applicationId": {
      "type": "string",
      "minLength": 1,
      "description": "CAP Application.id when the producer is CAP"
    },
    "levelEnrollmentId": {
      "type": "string",
      "minLength": 1,
      "description": "LMS level enrollment id when the producer is LMS"
    }
  },
  "oneOf": [
    {
      "required": ["applicationId"],
      "properties": { "levelEnrollmentId": false }
    },
    {
      "required": ["levelEnrollmentId"],
      "properties": { "applicationId": false }
    }
  ]
}
