{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/opoint/json-schema/opoint-customer-usage-list-response-schema.json",
  "title": "CustomerUsageListResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/opoint-customers-api-openapi.yml#/components/schemas/CustomerUsageListResponse",
  "type": "object",
  "properties": {
    "delivery": {
      "type": "string"
    },
    "customers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomerUsageListEntry"
      }
    }
  },
  "required": [
    "customers",
    "delivery"
  ],
  "$defs": {
    "CustomerUsageListEntry": {
      "type": "object",
      "properties": {
        "id_customer": {
          "type": "integer"
        },
        "name": {
          "type": "string"
        },
        "totals": {
          "$ref": "#/$defs/UsageDataPoint"
        },
        "deliveries": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UsageDelivery"
          }
        }
      },
      "required": [
        "deliveries",
        "id_customer",
        "name",
        "totals"
      ]
    },
    "UsageDataPoint": {
      "type": "object",
      "properties": {
        "from_ts": {
          "type": "integer",
          "description": "Unix timestamp (UTC) of interval start (inclusive)"
        },
        "to_ts": {
          "type": "integer",
          "description": "Unix timestamp (UTC) of interval end (exclusive)"
        },
        "requests": {
          "type": "integer"
        },
        "articles": {
          "type": "integer"
        },
        "tokens": {
          "type": "integer"
        },
        "ratio": {
          "type": "number",
          "format": "double",
          "description": "Articles per request"
        },
        "gaps": {
          "type": "integer",
          "description": "Safefeed only: missing articles in expected sequence"
        },
        "overlaps": {
          "type": "integer",
          "description": "Safefeed only: duplicate articles delivered"
        },
        "anomaly_scores": {
          "type": "object",
          "additionalProperties": {
            "type": "number",
            "format": "double"
          },
          "description": "Per-metric anomaly scores; only present when the anomalies param is used"
        }
      },
      "required": [
        "articles",
        "from_ts",
        "ratio",
        "requests",
        "to_ts",
        "tokens"
      ]
    },
    "UsageDelivery": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "id": {
          "type": "integer"
        },
        "data": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UsageDataPoint"
          }
        }
      },
      "required": [
        "data",
        "id",
        "type"
      ]
    }
  }
}