{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hmcts/json-schema/hmcts-result-page-schema.json",
  "title": "result-page",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hmcts-application-list-entry-results-api-openapi.yml#/components/schemas/result-page",
  "allOf": [
    {
      "$ref": "#/$defs/page"
    },
    {
      "properties": {
        "content": {
          "items": {
            "$ref": "#/$defs/result-get-dto"
          },
          "type": "array"
        }
      },
      "type": "object"
    }
  ],
  "$defs": {
    "page": {
      "description": "Generic Spring Data page.",
      "properties": {
        "pageNumber": {
          "description": "Zero-based page index.",
          "format": "int32",
          "type": "integer"
        },
        "pageSize": {
          "description": "Page size.",
          "format": "int32",
          "type": "integer"
        },
        "totalElements": {
          "description": "Total number of elements across all pages.",
          "format": "int64",
          "type": "integer"
        },
        "totalPages": {
          "description": "Total number of pages.",
          "format": "int32",
          "type": "integer"
        },
        "sort": {
          "$ref": "#/$defs/sort"
        },
        "first": {
          "type": "boolean"
        },
        "last": {
          "type": "boolean"
        },
        "elementsOnPage": {
          "description": "Total number of elements in the current page.",
          "format": "int32",
          "type": "integer"
        }
      },
      "required": [
        "content",
        "elementsOnPage",
        "pageNumber",
        "pageSize",
        "totalElements"
      ],
      "type": "object"
    },
    "result-get-dto": {
      "description": "Response payload to get an Application List Entry Result.",
      "properties": {
        "id": {
          "description": "Unique identifier of the Application List Entry Result.",
          "format": "uuid",
          "type": "string"
        },
        "entryId": {
          "description": "The Unique identifier of the parent Application List Entry belongs.",
          "format": "uuid",
          "type": "string"
        },
        "resultCode": {
          "description": "Code that identifies the Result Code.",
          "type": "string"
        },
        "updatedDateTime": {
          "description": "Date and time the Application List Entry Result was last updated.",
          "format": "date-time",
          "type": "string"
        },
        "wording": {
          "$ref": "#/$defs/template-detail"
        }
      },
      "required": [
        "entryId",
        "id",
        "resultCode",
        "updatedDateTime"
      ],
      "type": "object"
    },
    "sort": {
      "description": "Sorting state for the returned page.",
      "properties": {
        "orders": {
          "description": "Active sort orders in priority order.",
          "items": {
            "$ref": "#/$defs/sort_orders_inner"
          },
          "type": "array"
        }
      },
      "type": "object"
    },
    "sort_orders_inner": {
      "properties": {
        "property": {
          "description": "Property name used for sorting.",
          "type": "string"
        },
        "direction": {
          "description": "Sort direction.",
          "enum": [
            "asc",
            "desc"
          ],
          "type": "string"
        }
      },
      "required": [
        "direction",
        "property"
      ],
      "type": "object"
    },
    "template-constraint": {
      "description": "The template field with an associated value",
      "properties": {
        "type": {
          "description": "The data type of the value.",
          "enum": [
            "TEXT"
          ],
          "type": "string"
        },
        "length": {
          "description": "The length of the data value.",
          "type": "integer"
        }
      },
      "required": [
        "length",
        "type"
      ],
      "type": "object"
    },
    "template-detail": {
      "description": "The wording details",
      "properties": {
        "template": {
          "description": "The template name. It contains the field names between curly braces.",
          "type": "string"
        },
        "substitution-key-constraints": {
          "description": "A list of fields and the associated constraints",
          "items": {
            "$ref": "#/$defs/template-key-with-constraint"
          },
          "type": "array"
        }
      },
      "required": [
        "template"
      ],
      "type": "object"
    },
    "template-key-with-constraint": {
      "description": "The template field with an associated value",
      "properties": {
        "key": {
          "description": "Field key for substitution into the template.",
          "type": "string"
        },
        "value": {
          "description": "The optional value for the key.",
          "type": "string"
        },
        "constraint": {
          "allOf": [
            {
              "$ref": "#/$defs/template-constraint"
            }
          ],
          "description": "The constraint details for the field"
        }
      },
      "required": [
        "constraint",
        "key"
      ],
      "type": "object"
    }
  }
}