{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/folio/main/json-schema/folio-mediated-request-schema.json",
  "title": "mediatedRequest",
  "description": "Mediated request",
  "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/mediatedRequest",
  "type": "object",
  "properties": {
    "id": {
      "$ref": "#/$defs/uuid"
    },
    "requestLevel": {
      "description": "Level of the request - Item or Title",
      "type": "string",
      "enum": [
        "Item",
        "Title"
      ]
    },
    "requestType": {
      "description": "Whether the item should be held upon return, recalled or paged for",
      "type": "string",
      "enum": [
        "Hold",
        "Recall",
        "Page"
      ]
    },
    "requestDate": {
      "description": "Date when the request was placed",
      "type": "string",
      "format": "date-time"
    },
    "patronComments": {
      "description": "Comments made by the patron",
      "type": "string"
    },
    "requesterId": {
      "$ref": "#/$defs/uuid"
    },
    "requester": {
      "description": "Copy of some requester data",
      "type": "object",
      "properties": {
        "firstName": {
          "description": "First name of the requester",
          "type": "string"
        },
        "lastName": {
          "description": "Last name of the requester",
          "type": "string"
        },
        "middleName": {
          "description": "Middle name of the requester",
          "type": "string"
        },
        "barcode": {
          "description": "Barcode of the requester",
          "type": "string"
        },
        "patronGroupId": {
          "$ref": "#/$defs/uuid"
        },
        "patronGroup": {
          "description": "Patron group of the requester",
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/uuid"
            },
            "group": {
              "description": "Patron group name",
              "type": "string"
            },
            "desc": {
              "description": "Patron group description",
              "type": "string"
            }
          }
        }
      }
    },
    "proxyUserId": {
      "$ref": "#/$defs/uuid"
    },
    "proxy": {
      "description": "Copy of some proxy patron data",
      "type": "object",
      "properties": {
        "firstName": {
          "description": "First name of the proxy patron",
          "type": "string"
        },
        "lastName": {
          "description": "Last name of the proxy patron",
          "type": "string"
        },
        "middleName": {
          "description": "Middle name of the proxy patron",
          "type": "string"
        },
        "barcode": {
          "description": "Barcode of the proxy patron",
          "type": "string"
        },
        "patronGroupId": {
          "$ref": "#/$defs/uuid"
        },
        "patronGroup": {
          "description": "Patron group of the proxy patron",
          "type": "object",
          "properties": {
            "id": {
              "$ref": "#/$defs/uuid"
            },
            "group": {
              "description": "Patron group name",
              "type": "string"
            },
            "desc": {
              "description": "Patron group description",
              "type": "string"
            }
          }
        }
      }
    },
    "instanceId": {
      "$ref": "#/$defs/uuid"
    },
    "instance": {
      "description": "Copy of some instance data",
      "type": "object",
      "properties": {
        "title": {
          "description": "Title of the instance\",",
          "type": "string"
        },
        "identifiers": {
          "description": "An extensible set of name-value pairs of identifiers associated with the resource",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "identifierTypeId": {
                "$ref": "#/$defs/uuid"
              },
              "value": {
                "description": "Resource identifier value",
                "type": "string"
              }
            },
            "required": [
              "identifierTypeId",
              "value"
            ]
          }
        },
        "contributorNames": {
          "description": "A list of contributor names",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "description": "Contributor name",
                "type": "string"
              }
            }
          }
        },
        "publication": {
          "description": "Publication information",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "publisher": {
                "description": "Name of the publisher",
                "type": "string"
              },
              "place": {
                "description": "Place of publication",
                "type": "string"
              },
              "dateOfPublication": {
                "description": "Date of publication",
                "type": "string"
              },
              "role": {
                "description": "Role of the publisher",
                "type": "string"
              }
            }
          }
        },
        "editions": {
          "description": "The edition statement, imprint and other publication source information",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "hrid": {
          "description": "The human readable ID, also called eye readable ID. A system-assigned sequential ID which maps to the Instance ID",
          "type": "string"
        }
      },
      "required": [
        "title",
        "identifiers"
      ]
    },
    "holdingsRecordId": {
      "$ref": "#/$defs/uuid"
    },
    "itemId": {
      "$ref": "#/$defs/uuid"
    },
    "item": {
      "description": "Copy of some item data",
      "type": "object",
      "properties": {
        "barcode": {
          "description": "Barcode of the item",
          "type": "string"
        },
        "location": {
          "description": "Effective location of the item",
          "type": "object",
          "properties": {
            "name": {
              "description": "Name of the location",
              "type": "string"
            },
            "libraryName": {
              "description": "Library name of the location",
              "type": "string"
            },
            "code": {
              "description": "Code of the location",
              "type": "string"
            }
          }
        },
        "enumeration": {
          "description": "Enumeration of the item",
          "type": "string"
        },
        "volume": {
          "description": "Volume of the item",
          "type": "string"
        },
        "chronology": {
          "description": "Chronology of the item",
          "type": "string"
        },
        "displaySummary": {
          "description": "Display summary of the item",
          "type": "string"
        },
        "status": {
          "description": "Status of the item",
          "type": "string"
        },
        "callNumber": {
          "description": "Call number of the item",
          "type": "string"
        },
        "callNumberComponents": {
          "description": "Components of the item's call number",
          "type": "object",
          "properties": {
            "callNumber": {
              "description": "Call number of the item",
              "type": "string"
            },
            "prefix": {
              "description": "Prefix of the item's call number",
              "type": "string"
            },
            "suffix": {
              "description": "Suffix of the item's call number",
              "type": "string"
            }
          }
        },
        "copyNumber": {
          "description": "Copy number of the item",
          "type": "string"
        }
      }
    },
    "mediatedWorkflow": {
      "description": "Mediated workflow that mediated request follows",
      "type": "string"
    },
    "mediatedRequestStatus": {
      "description": "Status of the mediated request",
      "type": "string",
      "enum": [
        "New",
        "Open",
        "Closed"
      ]
    },
    "mediatedRequestStep": {
      "description": "Step of the mediated request in mediated workflow",
      "type": "string"
    },
    "status": {
      "description": "Status of the mediated request",
      "type": "string",
      "enum": [
        "New - Awaiting confirmation",
        "Open - Not yet filled",
        "Open - In transit for approval",
        "Open - Item arrived",
        "Open - In transit to be checked out",
        "Open - Awaiting pickup",
        "Open - Awaiting delivery",
        "Closed - Cancelled",
        "Closed - Declined",
        "Closed - Filled"
      ]
    },
    "cancellationReasonId": {
      "$ref": "#/$defs/uuid"
    },
    "cancelledByUserId": {
      "$ref": "#/$defs/uuid"
    },
    "cancellationAdditionalInformation": {
      "description": "Additional information about mediated request cancellation",
      "type": "string"
    },
    "cancelledDate": {
      "description": "Date when the request was cancelled",
      "type": "string",
      "format": "date-time"
    },
    "position": {
      "description": "Position of the mediated request in the queue",
      "type": "integer"
    },
    "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": {
      "$ref": "#/$defs/uuid"
    },
    "deliveryAddress": {
      "description": "Delivery address",
      "type": "object",
      "properties": {
        "addressTypeId": {
          "description": "ID of the delivery address type",
          "type": "string"
        },
        "addressLine1": {
          "description": "Address line 1",
          "type": "string"
        },
        "addressLine2": {
          "description": "Address line 2",
          "type": "string"
        },
        "city": {
          "description": "City",
          "type": "string"
        },
        "region": {
          "description": "Region",
          "type": "string"
        },
        "postalCode": {
          "description": "Postal code",
          "type": "string"
        },
        "countryId": {
          "description": "Country ID",
          "type": "string"
        }
      }
    },
    "pickupServicePointId": {
      "$ref": "#/$defs/uuid"
    },
    "pickupServicePoint": {
      "description": "Pickup service point",
      "type": "object",
      "properties": {
        "name": {
          "description": "Pickup service point name",
          "type": "string"
        },
        "code": {
          "description": "Pickup service point code",
          "type": "string"
        },
        "discoveryDisplayName": {
          "description": "Pickup service point discovery display name",
          "type": "string"
        },
        "description": {
          "description": "Pickup service point description",
          "type": "string"
        },
        "shelvingLagTime": {
          "description": "Pickup service point description",
          "type": "integer"
        },
        "pickupLocation": {
          "description": "Whether pickup service point is a pickup location",
          "type": "boolean"
        }
      }
    },
    "confirmedRequestId": {
      "$ref": "#/$defs/uuid"
    },
    "searchIndex": {
      "description": "Request fields used for search",
      "type": "object",
      "properties": {
        "callNumberComponents": {
          "description": "Effective call number components",
          "type": "object",
          "properties": {
            "callNumber": {
              "description": "Effective Call Number is an identifier assigned to an item or its holding and associated with the item",
              "type": "string"
            },
            "prefix": {
              "description": "Effective Call Number Prefix is the prefix of the identifier assigned to an item or its holding and associated with the item",
              "type": "string"
            },
            "suffix": {
              "description": "Effective Call Number Suffix is the suffix of the identifier assigned to an item or its holding and associated with the item",
              "type": "string"
            }
          }
        },
        "shelvingOrder": {
          "description": "A system generated normalization of the call number that allows for call number sorting in reports and search results",
          "type": "string"
        },
        "pickupServicePointName": {
          "description": "The name of the request pickup service point",
          "type": "string"
        }
      }
    },
    "metadata": {
      "$ref": "#/$defs/metadata"
    }
  },
  "required": [
    "requestLevel",
    "requestType",
    "requestDate",
    "requesterId",
    "instanceId",
    "fulfillmentPreference"
  ],
  "$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"
        }
      }
    },
    "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}$"
    }
  }
}