{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "EnrollmentEvent.json",
  "title": "Enrollment event object",
  "description": "Sent with enrollment.* events. Unlike the enrollments endpoint, it includes the billing cycle.",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int32",
      "description": "Enrollment id."
    },
    "customerId": {
      "type": "integer",
      "format": "int32",
      "description": "The customer."
    },
    "serviceId": {
      "type": "integer",
      "format": "int32",
      "description": "The service."
    },
    "amount": {
      "type": "number",
      "format": "decimal",
      "description": "The agreed amount, else the service's price."
    },
    "billingCycle": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "monthly",
        "quarterly",
        "half_yearly",
        "yearly",
        null
      ],
      "description": "How often the service is billed."
    },
    "nextBillingDate": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T00:00:00$",
      "description": "The next billing date."
    },
    "cycleDate": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T00:00:00$",
      "description": "The billing date that arrived. Set only on enrollment.cycle_due."
    },
    "enrolledFrom": {
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T00:00:00$",
      "description": "Start date."
    },
    "enrolledTo": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T00:00:00$",
      "description": "End date."
    },
    "active": {
      "type": "boolean",
      "description": "Whether the enrollment is active."
    }
  },
  "required": [
    "id",
    "customerId",
    "serviceId",
    "amount",
    "billingCycle",
    "nextBillingDate",
    "cycleDate",
    "enrolledFrom",
    "enrolledTo",
    "active"
  ],
  "examples": [
    {
      "id": 31,
      "customerId": 812,
      "serviceId": 7,
      "amount": 250000,
      "billingCycle": "monthly",
      "nextBillingDate": "2026-12-01T00:00:00",
      "cycleDate": "2026-11-01T00:00:00",
      "enrolledFrom": "2026-10-01T00:00:00",
      "enrolledTo": null,
      "active": true
    }
  ]
}
