{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/propertyindex-ae/json-schema/propertyindex-ae-usage-schema.json",
  "title": "Usage",
  "x-generated": "2026-11-07",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/propertyindex-ae-openapi.json#/components/schemas/Usage",
  "type": "object",
  "required": [
    "kind",
    "unit",
    "used",
    "allowance",
    "remaining",
    "hardCap",
    "periodKey",
    "periodEnd",
    "overageEnabled",
    "overageCapMinor",
    "overageRecords",
    "overageCostMinor",
    "recordLimit",
    "recordsRemaining"
  ],
  "properties": {
    "kind": {
      "type": "string",
      "enum": [
        "paid",
        "demo"
      ]
    },
    "unit": {
      "type": "string",
      "const": "records"
    },
    "used": {
      "type": "integer",
      "minimum": 0,
      "description": "Sales and rental records returned in this period. Repeated retrievals count again."
    },
    "allowance": {
      "type": "integer",
      "minimum": 0,
      "description": "Included records: 1,000,000 per paid billing period, or the fixed demo grant."
    },
    "remaining": {
      "type": "integer",
      "minimum": 0,
      "description": "Included records remaining: max(0, allowance - used). Excludes overage capacity."
    },
    "hardCap": {
      "type": "boolean",
      "const": true,
      "description": "Always true. A response exceeding recordsRemaining is rejected in full without consuming records."
    },
    "periodKey": {
      "type": "string"
    },
    "periodEnd": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "overageEnabled": {
      "type": "boolean",
      "description": "Off by default. Requires paid-plan owner/admin opt-in and a finite monthly overage spending cap. Demos do not support overage."
    },
    "overageCapMinor": {
      "type": "integer",
      "minimum": 0,
      "description": "Monthly overage spending cap in fils (100 fils = AED 1)."
    },
    "overageRecords": {
      "type": "integer",
      "minimum": 0,
      "description": "Records above the included allowance: max(0, used - allowance)."
    },
    "overageCostMinor": {
      "type": "integer",
      "minimum": 0,
      "description": "Overage cost in fils, rounded on the billing period total: round(overageRecords / 5). Equivalent to AED 2 per 1,000 records."
    },
    "recordLimit": {
      "type": "integer",
      "minimum": 0,
      "description": "Effective record limit: allowance + (overageEnabled ? overageCapMinor * 5 : 0)."
    },
    "recordsRemaining": {
      "type": "integer",
      "minimum": 0,
      "description": "Effective records remaining, including enabled overage capacity: max(0, recordLimit - used)."
    }
  }
}