{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "definitions": {
    "payment": {
      "properties": {
        "budget_code": {
          "title": "A generic budget code used for the ILL borrowing request",
          "type": "string"
        },
        "debit_cost": {
          "$ref": "#/definitions/price",
          "title": "Payment price"
        },
        "debit_cost_main_currency": {
          "$ref": "#/definitions/price",
          "title": "Payment price in the main currency"
        },
        "debit_date": {
          "format": "date",
          "title": "Debit date",
          "type": "string"
        },
        "debit_note": {
          "title": "Debit note",
          "type": "string"
        },
        "internal_purchase_requisition_id": {
          "title": "The internal purchase requisition ID",
          "type": "string"
        },
        "mode": {
          "title": "Payment mode (Vocabulary)",
          "type": "string"
        }
      },
      "type": "object"
    },
    "price": {
      "properties": {
        "currency": {
          "title": "Currency of the price (Vocabulary)",
          "type": "string"
        },
        "value": {
          "minimum": 0,
          "title": "Price value",
          "type": "number"
        }
      },
      "required": ["value", "currency"],
      "type": "object"
    }
  },
  "properties": {
    "$schema": {
      "title": "InterLibrary borrowing request schema",
      "type": "string"
    },
    "cancel_reason": {
      "title": "Reason for cancelling the ILL borrowing request",
      "type": "string"
    },
    "created_by": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "document": {
      "properties": {
        "$ref": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "document_pid": {
      "title": "The persistent identifier of the Document",
      "type": "string"
    },
    "due_date": {
      "format": "date",
      "title": "Due date of the ILL borrowing request",
      "type": "string"
    },
    "expected_delivery_date": {
      "format": "date",
      "minLength": 1,
      "title": "Expected delivery date of the item requested",
      "type": "string"
    },
    "legacy_id": {
      "type": "string",
      "title": "The previous id of this borrowing request before data migration"
    },
    "provider": {
      "properties": {
        "$ref": {
          "type": "string"
        }
      },
      "title": "The link, as a resolver, to the lending provider",
      "type": "object"
    },
    "provider_pid": {
      "title": "The persistent identifier of the lending provider",
      "type": "string"
    },
    "notes": {
      "title": "The notes of the ILL borrowing request",
      "type": "string"
    },
    "patron": {
      "properties": {
        "$ref": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "patron_pid": {
      "title": "The persistent identifier of the patron who made the request",
      "type": "string"
    },
    "payment": {
      "$ref": "#/definitions/payment",
      "title": "ILL borrowing request payment"
    },
    "patron_loan": {
      "extension": {
        "properties": {
          "notes": {
            "title": "The notes of the extension",
            "type": "string"
          },
          "request_date": {
            "format": "date",
            "minLength": 1,
            "title": "Date of the extension request",
            "type": "string"
          },
          "status": {
            "title": "Status of the extension",
            "type": "string"
          }
        },
        "title": "Patron loan extensions",
        "type": "object"
      },
      "pid": {
        "title": "The persistent identifier of the loan created from this borrowing request",
        "type": "string"
      }
    },
    "pid": {
      "title": "The persistent identifier of ILL borrowing request",
      "type": "string"
    },
    "received_date": {
      "format": "date",
      "title": "Date of when the item requested was received",
      "type": "string"
    },
    "request_date": {
      "format": "date",
      "minLength": 1,
      "title": "Date of the request",
      "type": "string"
    },
    "status": {
      "title": "Status of the ILL borrowing request",
      "type": "string"
    },
    "total": {
      "$ref": "#/definitions/price",
      "title": "Order total"
    },
    "total_main_currency": {
      "$ref": "#/definitions/price",
      "title": "Order total in the main currency"
    },
    "type": {
      "title": "The type of the item requested, normally physical or electronic (Vocabulary)",
      "type": "string"
    },
    "updated_by": {
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "type": "string"
        }
      },
      "title": "Last update entity information",
      "type": "object"
    }
  },
  "required": [
    "$schema",
    "pid",
    "status",
    "document_pid",
    "patron_pid",
    "provider_pid",
    "type"
  ],
  "title": "Schema for the ILL borrowing request",
  "type": "object"
}
