{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/componecat-ai/json-schema/componecat-ai-license-resource-schema.json",
  "title": "LicenseResource",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/componecat-ai-licensing-api-openapi.yml#/components/schemas/LicenseResource",
  "required": [
    "id",
    "planId",
    "planName",
    "effectiveAt",
    "createdAt",
    "updatedAt",
    "overages",
    "history"
  ],
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "planId": {
      "type": "string"
    },
    "planName": {
      "type": "string"
    },
    "effectiveAt": {
      "type": "string",
      "format": "date-time"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": [
        "null",
        "string"
      ],
      "format": "date-time"
    },
    "overages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/OverageResource"
      }
    },
    "history": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LicenseHistoryResource"
      }
    }
  },
  "$defs": {
    "LicenseHistoryResource": {
      "required": [
        "planId",
        "planName",
        "effectiveAt",
        "endedAt",
        "changeSource"
      ],
      "type": "object",
      "properties": {
        "planId": {
          "type": "string"
        },
        "planName": {
          "type": "string"
        },
        "effectiveAt": {
          "type": "string",
          "format": "date-time"
        },
        "endedAt": {
          "type": [
            "null",
            "string"
          ],
          "format": "date-time"
        },
        "changeSource": {
          "type": "string"
        }
      }
    },
    "OverageResource": {
      "required": [
        "entitlementKey",
        "currentValue",
        "allowedValue",
        "label"
      ],
      "type": "object",
      "properties": {
        "entitlementKey": {
          "type": "string"
        },
        "currentValue": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "allowedValue": {
          "pattern": "^-?(?:0|[1-9]\\d*)$",
          "type": [
            "integer",
            "string"
          ],
          "format": "int32"
        },
        "label": {
          "type": "string"
        }
      }
    }
  }
}