{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://api.stigg.io/schemas/usage-measurement",
  "title": "UsageMeasurement",
  "description": "A recorded usage measurement for a metered feature associated with a Stigg customer.",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier of the usage measurement."
    },
    "customerId": {
      "type": "string",
      "description": "The customer ID for which usage was reported."
    },
    "featureId": {
      "type": "string",
      "description": "The feature ID for which usage was reported."
    },
    "value": {
      "type": "number",
      "description": "The reported usage value."
    },
    "updateBehavior": {
      "type": "string",
      "enum": ["DELTA", "SET"],
      "description": "Whether the value was a delta increment (DELTA) or an absolute set (SET)."
    },
    "idempotencyKey": {
      "type": ["string", "null"],
      "description": "Idempotency key used to prevent duplicate reporting."
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "description": "The timestamp of the usage measurement."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp of when the measurement was recorded."
    }
  },
  "required": ["id", "customerId", "featureId", "value", "timestamp"]
}
