{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/fusio/main/json-schema/fusio-backend-rate-collection-schema.json",
  "title": "Backend_RateCollection",
  "description": "Base collection",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/fusio-rate-api-openapi.yml#/components/schemas/Backend_RateCollection",
  "type": "object",
  "properties": {
    "totalResults": {
      "type": "integer"
    },
    "startIndex": {
      "type": "integer"
    },
    "itemsPerPage": {
      "type": "integer"
    },
    "entry": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Backend_Rate"
      }
    }
  },
  "$defs": {
    "Backend_Rate": {
      "description": "This object represents a rate limitation, which allows to limit the requests which a user can send",
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for the object",
          "type": "integer"
        },
        "priority": {
          "description": "All rates are applied based on the priority, higher priorities are applied first",
          "type": "integer"
        },
        "name": {
          "description": "Unique name of the object",
          "type": "string"
        },
        "rateLimit": {
          "description": "Maximum number of allowed requests",
          "type": "integer"
        },
        "timespan": {
          "description": "Timespan for the allowed requests",
          "type": "string"
        },
        "allocation": {
          "description": "Through a rate allocation a user gets assigned to a specific rate",
          "type": "array",
          "items": {
            "$ref": "#/$defs/Backend_RateAllocation"
          }
        },
        "metadata": {
          "$ref": "#/$defs/Common_Metadata"
        }
      }
    },
    "Backend_RateAllocation": {
      "description": "This object represents a rate allocation, in case a request matches it gets assigned to the attached rate",
      "type": "object",
      "properties": {
        "id": {
          "description": "Unique identifier for the object",
          "type": "integer"
        },
        "operationId": {
          "type": "integer"
        },
        "userId": {
          "type": "integer"
        },
        "planId": {
          "type": "integer"
        },
        "appId": {
          "type": "integer"
        },
        "authenticated": {
          "description": "Whether the request is authenticated",
          "type": "boolean"
        }
      }
    },
    "Common_Metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    }
  }
}