{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/newcastle/json-schema/newcastle-pagination-schema.json",
  "title": "Pagination",
  "description": "Defines the metadata for the pagination used for providing the data on the given endpoint.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/newcastle-collections-api-openapi.yml#/components/schemas/Pagination",
  "type": "object",
  "properties": {
    "size": {
      "type": "number",
      "description": "Represents how many items can be presented on one page."
    },
    "totalPages": {
      "type": "number",
      "description": "Represents how many pages are in total to fetch."
    },
    "totalElements": {
      "type": "number",
      "description": "Represents how many items are in total to fetch."
    },
    "number": {
      "type": "number",
      "description": "Represents the current page's number."
    },
    "_links": {
      "type": "object",
      "description": "Standard set of links related to pagination.",
      "properties": {
        "first": {
          "$ref": "#/$defs/HateoasLink"
        },
        "previous": {
          "$ref": "#/$defs/HateoasLink"
        },
        "next": {
          "$ref": "#/$defs/HateoasLink"
        },
        "last": {
          "$ref": "#/$defs/HateoasLink"
        }
      },
      "required": [
        "first",
        "last"
      ]
    }
  },
  "required": [
    "size",
    "totalPages",
    "totalElements",
    "number",
    "_links"
  ],
  "$defs": {
    "HateoasLink": {
      "type": "object",
      "properties": {
        "href": {
          "type": "string"
        },
        "type": {
          "type": "string",
          "enum": [
            "GET",
            "POST",
            "PUT",
            "DELETE"
          ]
        },
        "parameters": {
          "$ref": "#/$defs/HateoasParameters"
        }
      },
      "required": [
        "href",
        "type"
      ]
    },
    "HateoasParameters": {
      "type": "object",
      "additionalProperties": true,
      "description": "Any relevant parameters that should be appended to the URL (for GET method) or passed as a payload for other HTTP methods."
    }
  }
}