{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/folio/main/json-schema/folio-bff-request-schema.json",
  "title": "bffRequest",
  "description": "Request for an item that might be at a different location or already checked out to another patron",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/folio-mod-circulation-bff-circulationbff-openapi.yml#/components/schemas/bffRequest",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of the request",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "requestType": {
      "description": "Whether the item should be held upon return, recalled or paged for",
      "type": "string",
      "enum": [
        "Hold",
        "Recall",
        "Page"
      ]
    },
    "requestLevel": {
      "description": "Level of the request - Item or Title",
      "type": "string",
      "enum": [
        "Item",
        "Title"
      ]
    },
    "requestDate": {
      "description": "Date the request was made",
      "type": "string",
      "format": "date-time"
    },
    "patronComments": {
      "description": "Comments made by the patron",
      "type": "string"
    },
    "requesterId": {
      "description": "ID of the user who made the request",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "proxyUserId": {
      "description": "ID of the user representing a proxy for the patron",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "instanceId": {
      "description": "ID of the instance being requested",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "holdingsRecordId": {
      "description": "ID of the holdings record being requested",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "itemId": {
      "description": "ID of the item being requested",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "item": {
      "description": "Copy of some item metadata (used for searching and sorting)",
      "type": "object",
      "properties": {
        "barcode": {
          "description": "barcode of the item",
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "requester": {
      "description": "Copy of some requesting patron metadata (used for searching and sorting), will be taken from the user referred to by the requesterId",
      "readonly": true,
      "type": "object",
      "properties": {
        "firstName": {
          "description": "first name of the patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "lastName": {
          "description": "last name of the patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "middleName": {
          "description": "middle name of the patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "barcode": {
          "description": "barcode of the patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "patronGroupId": {
          "description": "UUID for the patron group that this user belongs to",
          "type": "string",
          "readonly": true,
          "$ref": "#/$defs/uuid"
        },
        "patronGroup": {
          "type": "string",
          "description": "record for the user's patrongroup"
        }
      },
      "additionalProperties": true
    },
    "proxy": {
      "description": "Copy of some proxy patron metadata (used for searching and sorting), will be taken from the user referred to by the proxyUserId",
      "readonly": true,
      "type": "object",
      "properties": {
        "firstName": {
          "description": "first name of the proxy patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "lastName": {
          "description": "last name of the proxy patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "middleName": {
          "description": "middle name of the proxy patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "barcode": {
          "description": "barcode of the proxy patron (read only, defined by the server)",
          "type": "string",
          "readonly": true
        },
        "patronGroupId": {
          "description": "UUID for the patrongroup that this user belongs to",
          "type": "string",
          "readonly": true,
          "$ref": "#/$defs/uuid"
        },
        "patronGroup": {
          "description": "record for the user's patrongroup",
          "type": "object",
          "readonly": true,
          "properties": {
            "id": {
              "description": "ID of the patrongroup",
              "type": "string",
              "readonly": true,
              "$ref": "#/$defs/uuid"
            },
            "group": {
              "description": "The unique name of the patrongroup",
              "type": "string",
              "readonly": true
            },
            "desc": {
              "description": "A description of the patrongroup",
              "type": "string",
              "readonly": true
            }
          }
        }
      }
    },
    "fulfillmentPreference": {
      "description": "How should the request be fulfilled (whether the item should be kept on the hold shelf for collection or delivered to the requester)",
      "type": "string",
      "enum": [
        "Hold Shelf",
        "Delivery"
      ]
    },
    "deliveryAddressTypeId": {
      "description": "Deliver to the address of this type, for the requesting patron",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "deliveryAddress": {
      "description": "Address the item is to be delivered to (derived from requester information)",
      "type": "object",
      "readonly": true,
      "properties": {
        "addressLine1": {
          "description": "Address line 1",
          "type": "string",
          "readonly": true
        },
        "addressLine2": {
          "description": "Address line 2",
          "type": "string",
          "readonly": true
        },
        "city": {
          "description": "City name",
          "type": "string",
          "readonly": true
        },
        "region": {
          "description": "Region",
          "type": "string",
          "readonly": true
        },
        "postalCode": {
          "description": "Postal code",
          "type": "string",
          "readonly": true
        },
        "countryId": {
          "description": "Country code",
          "type": "string",
          "readonly": true
        },
        "addressTypeId": {
          "description": "Type of address (refers to address types)",
          "type": "string",
          "readonly": true,
          "$ref": "#/$defs/uuid"
        }
      }
    },
    "requestExpirationDate": {
      "description": "Date when the request expires",
      "type": "string",
      "format": "date-time"
    },
    "holdShelfExpirationDate": {
      "description": "Date when an item returned to the hold shelf expires",
      "type": "string",
      "format": "date-time"
    },
    "pickupServicePointId": {
      "description": "The ID of the Service Point where this request can be picked up",
      "type": "string",
      "$ref": "#/$defs/uuid"
    },
    "tags": {
      "type": "object",
      "description": "Tags",
      "$ref": "#/$defs/uuid"
    },
    "metadata": {
      "description": "Metadata about creation and changes to requests, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "#/$defs/metadata"
    },
    "requestProcessingParameters": {
      "type": "object",
      "description": "Additional parameters used for request processing and discarded afterwards. Not part of request record.",
      "properties": {
        "overrideBlocks": {
          "type": "object",
          "description": "Blocks to override if user has corresponding permissions",
          "$ref": "#/$defs/overrideBlocks"
        }
      }
    }
  },
  "required": [
    "requesterId",
    "requestType",
    "requestDate",
    "fulfillmentPreference",
    "instanceId",
    "requestLevel"
  ],
  "$defs": {
    "metadata": {
      "type": "object",
      "description": "Record metadata",
      "properties": {
        "createdDate": {
          "description": "Date and time when the record was created",
          "type": "string"
        },
        "createdByUserId": {
          "description": "ID of the user who created the record (when available)",
          "type": "string"
        },
        "createdByUsername": {
          "description": "Username of the user who created the record (when available)",
          "type": "string"
        },
        "updatedDate": {
          "description": "Date and time when the record was last updated",
          "type": "string"
        },
        "updatedByUserId": {
          "description": "ID of the user who last updated the record (when available)",
          "type": "string"
        },
        "updatedByUsername": {
          "description": "Username of the user who last updated the record (when available)",
          "type": "string"
        }
      }
    },
    "overrideBlocks": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "type": "object",
      "description": "Blocks to override (e.g. during checkout or renewal)",
      "properties": {
        "itemNotLoanableBlock": {
          "description": "'Item not loanable' block",
          "type": "object",
          "properties": {
            "dueDate": {
              "description": "Due date for a new loan",
              "type": "string",
              "format": "date-time"
            }
          },
          "additionalProperties": false,
          "required": [
            "dueDate"
          ]
        },
        "patronBlock": {
          "description": "Automated patron block",
          "type": "object",
          "additionalProperties": false
        },
        "itemLimitBlock": {
          "description": "Item limit block",
          "type": "object",
          "additionalProperties": false
        },
        "renewalBlock": {
          "description": "Renewal block",
          "type": "object",
          "additionalProperties": false
        },
        "renewalDueDateRequiredBlock": {
          "description": "Override renewal block which requires due date field",
          "type": "object",
          "properties": {
            "dueDate": {
              "description": "Due date for a new loan",
              "type": "string",
              "format": "date-time"
            }
          },
          "additionalProperties": false,
          "required": [
            "dueDate"
          ]
        },
        "comment": {
          "description": "Reason for override",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "uuid": {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "description": "A universally unique identifier (UUID), this is a 128-bit number used to identify a record and is shown in hex with dashes, for example 6312d172-f0cf-40f6-b27d-9fa8feaf332f; the UUID version must be from 1-5; see https://dev.folio.org/guides/uuids/",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    }
  }
}