{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "Enrollment.json",
  "title": "Enrollment",
  "description": "A customer's subscription to a service in the organization's catalogue.",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int32",
      "description": "Enrollment id."
    },
    "serviceId": {
      "type": "integer",
      "format": "int32",
      "description": "The service in the organization's catalogue."
    },
    "serviceName": {
      "type": [
        "string",
        "null"
      ],
      "description": "The service's name."
    },
    "amount": {
      "type": "number",
      "format": "decimal",
      "description": "The agreed amount, else the service's price. Major units."
    },
    "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. null if open-ended."
    },
    "active": {
      "type": "boolean",
      "description": "Active and within its dates today."
    }
  },
  "required": [
    "id",
    "serviceId",
    "serviceName",
    "amount",
    "enrolledFrom",
    "enrolledTo",
    "active"
  ],
  "examples": [
    {
      "id": 31,
      "serviceId": 7,
      "serviceName": "Subscription",
      "amount": 250000,
      "enrolledFrom": "2026-10-01T00:00:00",
      "enrolledTo": null,
      "active": true
    }
  ]
}
