{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.elimi.africa/contracts/events/lms.enrollment.activated.v1.json",
  "title": "lms.enrollment.activated data",
  "description": "data payload for lms.enrollment.activated. Emitted by LMS when an entitlement becomes active and the enrollment can be consumed (self_pay after payment.completed, admin/sponsor/cap grant, or zero-price enroll).",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "enrollmentId",
    "courseId",
    "learnerUserId",
    "entitlementId",
    "source",
    "activatedAt"
  ],
  "properties": {
    "enrollmentId": {
      "type": "string",
      "description": "LMS Enrollment.id"
    },
    "courseId": {
      "type": "string"
    },
    "learnerUserId": {
      "type": "string",
      "description": "Orchestrator User.id (not lms_users.id)"
    },
    "learnerLmsUserId": {
      "type": "string"
    },
    "entitlementId": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "enum": ["self_pay", "admin_grant", "cap_recommendation", "sponsor"]
    },
    "capApplicationId": {
      "type": ["string", "null"]
    },
    "activatedAt": {
      "type": "string",
      "format": "date-time"
    }
  }
}
