{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/normapi-com/main/json-schema/normapi-com-customer-page-schema.json",
  "title": "CustomerPage",
  "x-generated": "2026-10-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/normapi-com-customers-api-openapi.yml#/components/schemas/CustomerPage",
  "type": "object",
  "properties": {
    "month": {
      "type": "string"
    },
    "customers": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CustomerMonth"
      }
    },
    "withoutCustomer": {
      "description": "The calls that named no customer, for the whole month, on every\npage; null for a key bound to a customer.\n",
      "oneOf": [
        {
          "$ref": "#/$defs/CustomerCounts"
        },
        {
          "type": "null"
        }
      ]
    },
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pass as `cursor` for the next page; null on the last."
    }
  },
  "required": [
    "month",
    "customers",
    "withoutCustomer",
    "nextCursor"
  ],
  "$defs": {
    "CustomerCounts": {
      "type": "object",
      "properties": {
        "generated": {
          "type": "integer",
          "description": "Invoices generated (2xx) in the month — the number to bill on."
        },
        "refused": {
          "type": "integer",
          "description": "Generations answered 4xx — refused data, a limit or the ceiling."
        },
        "calls": {
          "type": "object",
          "description": "Calls per endpoint, every status: `generate`, `validate`, and any\nother endpoint the customer called.\n",
          "additionalProperties": {
            "type": "integer"
          }
        }
      },
      "required": [
        "generated",
        "refused",
        "calls"
      ]
    },
    "CustomerMonth": {
      "allOf": [
        {
          "$ref": "#/$defs/CustomerCounts"
        },
        {
          "type": "object",
          "properties": {
            "customer": {
              "type": "string"
            },
            "monthlyInvoices": {
              "type": [
                "integer",
                "null"
              ],
              "description": "The ceiling in force now, or null without one."
            }
          },
          "required": [
            "customer",
            "monthlyInvoices"
          ]
        }
      ]
    }
  }
}