openapi: 3.0.1
info:
  title: Elevate Product Inventory API
  description: >
    ### Management of usage and rental inventory items


    Product inventory controls the products and services that are assigned to
    Sites. 


    #### Rental Product Inventory


    A Rental Product Inventory (RPI) is the assignment of a Rental Product to a
    Site, for example, a broadband service or connection charge

    Where Rental Products are sold to a Customer the creation of a Rental
    Product Inventory notifies Elevate that there is a billable asset

    Properties of an RPI include start and end dates, i.e. between which dates
    should Elevate create a charge


    #### Usage Product Inventory


    A Usage Product Inventory (UPI) is the assignment of a Usage Product to a
    Site

    Where Usage Products are sold to a Customer the creation of a UPI notifies
    Elevate that there is a billable asset

    Properties of UPI include start and end dates, i.e. between which dates
    Elevate will create a charge for any usage associated with that UPI


    Unlike RPIs, the creation of charges for UPIs is dependent upon Elevate
    processing usage records (typically referred to as Call Detail Records

    or CDR) that are delivered by suppliers as files or some other mechanism.
    The usage records are associated with the correct UPI within Elevate


    #### Usage Product Reference


    A Usage Product Reference (UPR) is an identifier for a UPI. This 'product
    reference' could be a telephone number or other identifier depending 

    on the Usage Product. A single UPI can have many UPRs. Typically one of
    these UPRs is marked as the 'primary' (e.g. a main billing number) for 

    the UPI. Properties of UPR include start and end dates when they are
    associated to the UPI


    #### Adhoc Inventory


    An Adhoc Inventory is used to represent a charge, discount or refund that
    will be applied on an adhoc basis, for example, a charge

    for equipment/upfront costs or a discretionary payment. These can be part of
    the standard billing cycle or, unlike other inventory items, can be part of
    a

    dedicated adhoc bill run at any time


    #### Provisioning Details


    Once a Rental Product Inventory has been created it can have a phone line
    provisioned with a number of settings. Provisioning Details serve as a 

    representation of these settings, showing active/suspended lines, subscribed
    data bundles or add-ons, and smart/international-barred numbers
  version: '2.27'
servers:
  - url: https://rest.elevatebilling.com/v2
tags:
  - name: usage-product-inventories
    description: >-
      A Usage Product Inventory (UPI) is the assignment of a usage product to a
      Site. A UPI has 1 or more product reference (UPR)
  - name: rental-product-inventories
    description: >-
      A Rental Product Inventory (RPI) is the assignment of a rental product to
      a Site
  - name: adhoc-inventories
    description: >-
      An Adhoc Inventory is used to represent a charge, discount or refund that
      will be applied on an adhoc basis
  - name: provisioning-details
    description: >-
      A group of settings which detail the provisioning state of a rental
      product inventory
paths:
  /usage-product-inventories:
    get:
      tags:
        - usage-product-inventories
      summary: Get a list of available usage product inventories
      operationId: getUsageProductInventories
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: usageProductId
          in: query
          description: Filter by usage product id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: startDate
          in: query
          description: Filter by start date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: endDate
          in: query
          description: Filter by end date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: productReference
          in: query
          description: Filter by product reference
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: serviceId
          in: query
          description: Filter by service id
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: label
          in: query
          description: Filter by label
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UsageProductInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    head:
      tags:
        - usage-product-inventories
      summary: Check if usage product inventory exists
      operationId: checkUsageProductInventory
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: usageProductId
          in: query
          description: Filter by usage product id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: startDate
          in: query
          description: Filter by start date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: endDate
          in: query
          description: Filter by end date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: productReference
          in: query
          description: Filter by product reference
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: serviceId
          in: query
          description: Filter by service id
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: label
          in: query
          description: Filter by label
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    post:
      tags:
        - usage-product-inventories
      summary: Create a new usage product inventory
      operationId: createUsageProductInventory
      x-si-permissions:
        - CREATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New usage product inventory
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageProductInventory'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProductInventory'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProductInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
  /rental-product-inventories:
    get:
      tags:
        - rental-product-inventories
      summary: Get a list of available rental product inventories
      operationId: getRentalProductInventories
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: invoicePresentationProductName
          in: query
          description: Filter by invoice presentation name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: rentalProductId
          in: query
          description: Filter by rental product identifier
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: productReference
          in: query
          description: Filter by product reference
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: additionalProductReference
          in: query
          description: Filter by additional product reference
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: startDate
          in: query
          description: Filter by start date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: endDate
          in: query
          description: Filter by end date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: supplierAccountId
          in: query
          description: Filter by supplier account
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: label
          in: query
          description: Filter by label
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RentalProductInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    post:
      tags:
        - rental-product-inventories
      summary: Create a new rental product inventory
      operationId: createRentalProductInventory
      x-si-permissions:
        - CREATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: disable_adding_linked_rentals
          in: header
          description: >-
            A boolean flag to specify that any rental product inventories set to
            auto-generate (for the child rental products of the rental product
            assigned to this RPI) should be skipped
          required: false
          schema:
            $ref: '#/components/schemas/BooleanFilterParam'
      requestBody:
        description: New rental product inventory
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalProductInventory'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductInventory'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    head:
      tags:
        - rental-product-inventories
      summary: Check if rental product inventory exists
      operationId: checkRentalProductInventory
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: invoicePresentationProductName
          in: query
          description: Filter by invoice presentation name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: rentalProductId
          in: query
          description: Filter by rental product identifier
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: productReference
          in: query
          description: Filter by product reference
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: additionalProductReference
          in: query
          description: Filter by additional product reference
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: startDate
          in: query
          description: Filter by start date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: endDate
          in: query
          description: Filter by end date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: supplierAccountId
          in: query
          description: Filter by supplier account
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: label
          in: query
          description: Filter by label
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /provisioning-details:
    get:
      tags:
        - provisioning-details
      summary: Get a list of provisioning details
      description: >-
        Get a list of provisioning details for existing rental product
        inventories
      operationId: getProvisioningDetails
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory identifier
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProvisioningDetails'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    head:
      tags:
        - provisioning-details
      summary: Check if a set of provisioning details
      description: >-
        Check if a set of provisioning details for a rental product inventory
        exists
      operationId: checkProvisioningDetails
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /adhoc-inventories:
    get:
      tags:
        - adhoc-inventories
      summary: Get a list of available adhoc inventories
      operationId: getAdhocInventories
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: name
          in: query
          description: Filter by name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductCategoryId
          in: query
          description: Filter by rental product category
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: billRunId
          in: query
          description: Filter by billRunId
          required: false
          style: form
          explode: true
          schema:
            $ref: '#/components/schemas/IdFilterParam'
        - name: adhocBillRunId
          in: query
          description: Filter by adhocBillRunId
          required: false
          style: form
          explode: true
          schema:
            $ref: '#/components/schemas/IdFilterParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AdhocInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    head:
      tags:
        - adhoc-inventories
      summary: Check if adhoc inventory exists
      operationId: checkAdhocInventory
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: name
          in: query
          description: Filter by name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductCategoryId
          in: query
          description: Filter by rental product category
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    post:
      tags:
        - adhoc-inventories
      summary: Create a new adhoc inventory
      operationId: createAdhocInventory
      x-si-permissions:
        - CREATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New adhoc inventory
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdhocInventory'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdhocInventory'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdhocInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
  /usage-product-inventories/{usage_product_inventory_id}:
    get:
      tags:
        - usage-product-inventories
      summary: Get a specific usage product inventory
      operationId: getUsageProductInventory
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: usage_product_inventory_id
          in: path
          description: Usage product inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Usage product inventory found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProductInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    patch:
      tags:
        - usage-product-inventories
      summary: Update a usage product inventory
      operationId: updateUsageProductInventory
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end|pendingEnd)Date
        - /supplierAccountId
        - /billByServiceId
        - /serviceId
        - /billable
        - /inFlightOrder
        - /externalOrderReference
        - /externalNetworkOrderReference
        - /usageCapEnabled
        - /defaultUsageCap
        - /usageProductId
        - /applySurcharges
        - /productReferences.*
        - /customFields.*
        - /customFields/.*/id
        - /customFields/.*/value
        - /tripwirePlanId
        - /overrideUsageCap
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: usage_product_inventory_id
          in: path
          description: Usage product inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      requestBody:
        description: A set of JSONPatch operations to be performed
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchRequest'
            examples:
              TurnOnSurcharges:
                value:
                  - op: replace
                    path: /surchargesApply
                    value: 'true'
              UnendDate:
                value:
                  - op: remove
                    path: /endDate
              AddTelephoneNumber:
                value:
                  - op: add
                    path: /productReferences/-
                    value:
                      productReference: '01225891422'
                      primary: false
                      startDate: '2023-02-12'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProductInventory'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - usage-product-inventories
      summary: Delete usage product inventory
      operationId: deleteUsageProductInventory
      x-si-permissions:
        - DELETE_INVENTORY
      x-si-apply-impact-of-change: true
      x-si-requires-permission-to-delete: UsageProductInventory
      security:
        - bearerAuth: []
      parameters:
        - name: usage_product_inventory_id
          in: path
          description: Usage product inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: OK
          content: {}
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-product-references/{product_reference_id}:
    patch:
      tags:
        - usage-product-inventories
      summary: Update a UPI product reference
      operationId: updateUsageProductReference
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
        - /primary
        - /label
        - /user(Id|Email)
        - /(costCentre|department)Code
        - /notes
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: product_reference_id
          in: path
          description: Usage product reference identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      requestBody:
        description: A set of JSONPatch operations to be performed
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchRequest'
            examples:
              ChangeTheStartDate:
                value:
                  - op: replace
                    path: /startDate
                    value: '2023-01-13'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductReference'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - usage-product-inventories
      summary: Delete UPI product reference
      operationId: deleteUsageProductReference
      x-si-permissions:
        - DELETE_INVENTORY
      x-si-apply-impact-of-change: true
      x-si-requires-permission-to-delete: ProductReference
      security:
        - bearerAuth: []
      parameters:
        - name: product_reference_id
          in: path
          description: Usage product reference identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: OK
          content: {}
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-product-inventories/{rental_product_inventory_id}:
    get:
      tags:
        - rental-product-inventories
      summary: Get a specific rental product inventory
      operationId: getRentalProductInventory
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_inventory_id
          in: path
          description: Rental product identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Rental product inventory found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    delete:
      tags:
        - rental-product-inventories
      summary: Delete rental product inventory
      operationId: deleteRentalProductInventory
      x-si-permissions:
        - DELETE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_inventory_id
          in: path
          description: Rental product inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
        - name: force_cascade
          in: header
          description: >-
            A boolean flag to specify it will delete any associated feature or
            event rental product inventories
          required: false
          schema:
            $ref: '#/components/schemas/BooleanFilterParam'
      responses:
        '202':
          description: Accepted
          content: {}
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    patch:
      tags:
        - rental-product-inventories
      summary: Update a rental product inventory
      operationId: updateRentalProductInventory
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end|contractStart|pendingEnd)Date
        - /invoicePresentationProductName
        - /supplierAccountId
        - /invoiceFrequency
        - /quantity
        - /productReference
        - /additionalProductReference
        - /label
        - /treat(Start|End)AsWholePeriod
        - /user(Id|Email)
        - /(costCentre|department)Code
        - /featureNumber
        - /nominalCode
        - /notes
        - /billable
        - /inFlightOrder
        - /external(Order|NetworkOrder)Reference
        - /forceBilling
        - /forceBillPeriods
        - /installationAddress/businessName
        - /installationAddress/address[0-9]*
        - /installationAddress/town
        - /installationAddress/county
        - /installationAddress/postcode
        - /installationAddress/country
        - /customFields.*
        - /customFields/.*/id
        - /customFields/.*/value
        - /billInitialChargesImmediately
        - /alignedToStart
        - /alignedToBillPeriod
        - /invoiceGroupTagLabelId
        - /invoiceGroupTagValue
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_inventory_id
          in: path
          description: Rental product inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      requestBody:
        description: A set of JSONPatch operations to be performed
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchRequest'
            examples:
              ChangeTheStartDate:
                value:
                  - op: replace
                    path: /startDate
                    value: '2023-01-13'
              AddLabel:
                value:
                  - op: replace
                    path: /label
                    value: Hello World
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductInventory'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /adhoc-inventories/{adhoc_inventory_id}:
    get:
      tags:
        - adhoc-inventories
      summary: Get a specific adhoc inventory
      operationId: getAdhocInventory
      x-si-permissions:
        - VIEW_INVENTORY
      security:
        - bearerAuth: []
      parameters:
        - name: adhoc_inventory_id
          in: path
          description: Adhoc inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Adhoc inventory found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdhocInventory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '404':
          description: Not Found
          content: {}
        '412':
          description: Precondition Failed
          content: {}
        '500':
          description: Internal Server Error
          content: {}
        '501':
          description: Not Implemented Yet
          content: {}
    patch:
      tags:
        - adhoc-inventories
      summary: Update an ad hoc inventory
      operationId: updateAdhocInventory
      x-si-json-patch: true
      x-si-allow-patch:
        - /name
        - /supplierAccountId
        - /(buy|sell)Price
        - /billImmediately
        - /isCredit
        - /creditReason
        - /paid
        - /payment(Terms|Type)
        - /quantity
        - /taxBandId
        - /nominalCode
        - /invoiceGroupTagLabelId
        - /invoiceGroupTagValue
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_INVENTORY
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: adhoc_inventory_id
          in: path
          description: Adhoc inventory identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      requestBody:
        description: A set of JSONPatch operations to be performed
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchRequest'
            examples:
              Rename:
                value:
                  - op: replace
                    path: /name
                    value: MyAdhoc1
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdhocInventory'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
components:
  schemas:
    UsageProductInventory:
      required:
        - siteId
        - usageProductId
        - startDate
        - productReferences
      type: object
      x-si-no-change-allowed-in-finalised-bill-run: >
        fields = { "serviceId", "usageProductId", "startDate",
        "supplierAccountId", "billByServiceId" }
      x-si-only-billrun-owner-can-change-in-closed-bill-run: >
        fields = { "serviceId", "usageProductId", "startDate",
        "supplierAccountId", "billByServiceId" }
      x-si-class-validation: >
        @RequiredWhen(fieldName="billByServiceId",fieldValue="true",dependFieldName="serviceId")

        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Usage product inventory identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        siteId:
          description: Site identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        usageProductId:
          description: Usage product identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        startDate:
          description: Start date
          type: string
          format: date
        endDate:
          description: End date
          type: string
          format: date
        supplierAccountId:
          description: Supplier account identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
        billByServiceId:
          description: Bill by Service ID
          type: boolean
          default: false
        serviceId:
          type: string
          description: >-
            Service ID. Extra validations may be applied depending on product
            configurations
          minLength: 1
          maxLength: 100
        billable:
          description: Billable charge
          type: boolean
          default: true
        inFlightOrder:
          description: In-flight order
          type: boolean
          default: false
        externalOrderReference:
          type: string
          description: external order reference
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        externalNetworkOrderReference:
          type: string
          description: external Network order reference
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        pendingEndDate:
          description: Inflight order pending end date
          type: string
          format: date
        usageCapEnabled:
          description: Usage cap enabled
          type: boolean
          default: false
        defaultUsageCap:
          description: >-
            Default usage cap amount. Specify the value in minor currency units
            (i.e. pence for GBP, cents for EUR/USD)
          type: number
        overrideUsageCap:
          description: >-
            Override the default usage cap amount temporarily. Specify the value
            in minor currency units (e.g. pence for GBP, cents for EUR/USD)
          type: number
        applySurcharges:
          description: >-
            Do surcharge apply to this UPI? If true and a rate is found with a
            surchargeValue greater than 0 then an additional surcharge will be
            applied to the usage cost
          type: boolean
          default: false
        productReferences:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/ProductReference'
        tripwirePlanId:
          description: Tripwire plan identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
    RentalProductInventory:
      required:
        - siteId
        - rentalProductId
        - invoicePresentationProductName
        - supplierAccountId
        - startDate
        - invoiceFrequency
        - quantity
      type: object
      x-si-no-change-allowed-in-finalised-bill-run: >
        fields = { "siteId", "rentalProductId",
        "parentRentalProductInventoryId", "supplierAccountId", "startDate",
        "invoiceFrequency", "quantity", "productReference",
        "additionalProductReference", "treatStartAsWholePeriod",
        "treatEndAsWholePeriod", "billable", "billInitialChargesImmediately",
        "forceBilling", "forceBillPeriods", "alignedToStart",
        "alignedToBillPeriod" }
      x-si-only-billrun-owner-can-change-in-closed-bill-run: >
        fields = { "siteId", "rentalProductId",
        "parentRentalProductInventoryId", "supplierAccountId", "startDate",
        "invoiceFrequency", "quantity", "productReference",
        "additionalProductReference", "treatStartAsWholePeriod",
        "treatEndAsWholePeriod", "billable", "billInitialChargesImmediately",
        "forceBilling", "forceBillPeriods", "alignedToStart",
        "alignedToBillPeriod" }
      x-si-class-validation: >
        @NotAllowedWhenNotNull(fieldName="parentRentalProductInventoryId",
        dependFieldName="installationAddress")

        @After(first = "endDate", second = "startDate")

        @NotAllowedWhen.List({
          @NotAllowedWhen(fieldName="alignedToBillPeriod", fieldValue="true", dependFieldName="alignedToStart"),
          @NotAllowedWhen(fieldName="alignedToBillPeriod", fieldValue="true", dependFieldName="treatStartAsWholePeriod"),
          @NotAllowedWhen(fieldName="alignedToBillPeriod", fieldValue="true", dependFieldName="treatEndAsWholePeriod"),
          @NotAllowedWhen(fieldName="alignedToStart", fieldValue="true", dependFieldName="treatStartAsWholePeriod"),
          @NotAllowedWhen(fieldName="alignedToStart", fieldValue="true", dependFieldName="treatEndAsWholePeriod")
        })
      properties:
        id:
          description: Rental product inventory identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        siteId:
          description: Site identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        rentalProductId:
          description: Rental product identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        parentRentalProductInventoryId:
          description: Parent product identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        invoicePresentationProductName:
          type: string
          description: Product name as presented on invoice
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        supplierAccountId:
          description: Supplier account identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        startDate:
          description: Rental product inventory start date
          type: string
          format: date
        endDate:
          description: Rental product inventory end date
          type: string
          format: date
        invoiceFrequency:
          description: >-
            The rental records will be generated on every invoice per period
            (day/week/month) depending on the billing cycle with which the
            customer is associated. However you may wish to group the charges so
            they are included a frequency per period. So you might set the
            frequency to 3 and on the monthly cycle it would have a line item on
            the invoice for this RPI that covers three months. The next two
            months no line item on the invoice will be listed
          type: integer
          format: int32
        quantity:
          description: Quantity
          type: integer
          format: int32
          minimum: 1
          maximum: 1000000
        productReference:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            Product reference. Extra validations may be applied depending on
            product configurations
        additionalProductReference:
          type: string
          minLength: 1
          maxLength: 100
          description: >-
            In the case of an ISDN service, this reference can be used to link
            the usage product inventory (UPI) and the Rental Product Inventory
            (RPI) since a main billing number (MBN) would not be available.
            Extra validations may be applied depending on product configurations
        label:
          type: string
          description: Label
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        treatStartAsWholePeriod:
          description: >-
            If enabled this property will stop pro-rated charges being
            calculated at the start of the rental product inventory
          type: boolean
          default: false
        treatEndAsWholePeriod:
          description: >-
            If enabled this property will stop pro-rated charges being
            calculated at the end of the rental product inventory
          type: boolean
          default: false
        contractStartDate:
          description: Contract start date
          type: string
          format: date
          deprecated: true
        userId:
          type: string
          description: User Id
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        userEmail:
          description: User email address
          type: string
          minLength: 1
          maxLength: 255
          pattern: >-
            [a-zA-Z0-9.!#$%&'\*\+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*
        costCentreCode:
          type: string
          description: Cost centre code
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        departmentCode:
          type: string
          description: Department code
          minLength: 1
          maxLength: 500
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        featureNumber:
          type: string
          description: Feature number
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        nominalCode:
          type: string
          description: Nominal code
          minLength: 1
          maxLength: 100
          pattern: ^[\w\p{L}\s%£@&#=':;,`’|!_—–()/\-+.?*$\[\]€^{}<>~]*$
          example: SALES-01QTR2
        notes:
          type: string
          description: Notes
          minLength: 0
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        billable:
          description: >-
            Is this rental product inventory to be billed now? If it is
            un-ticked then it will not appear on an invoice
          type: boolean
          default: true
        inFlightOrder:
          description: >-
            If selected this property denotes that the order has not yet
            completed
          type: boolean
          default: false
        billInitialChargesImmediately:
          description: >-
            When enabled, the initial rental charge (usually a part-period
            charge) will be billed immediately via an adhoc bill run
          type: boolean
          default: false
        alignedToStart:
          description: >-
            The Rental Product Inventory (RPI) will align to the anniversary of
            the start date as opposed to pro-rating to align with the billing
            period. For example, if the start date is the 10th, the RPI will
            bill every month, every quarter, and every year from the 10th with
            no pro-rating. This feature is particularly useful for annual
            charges to ensure that only 12 months are billed and that the charge
            will recur every 12 months on the anniversary of the start date
          type: boolean
          default: false
        alignedToBillPeriod:
          description: >-
            Where Rental Product Inventory (RPI) are added with start dates that
            are in the past, the default behaviour is to pro-rate multiple
            months up to the current bill period and then bill the required
            frequency. For example, this could result in 2.5 months pro-rated
            plus the next quarter being charged. Using this feature ensures that
            the RPI will pro-rate a maximum of one part month and then bill the
            required frequency. For example, a quarterly charge with a start
            date 2.5 months in the past will pro-rate the 0.5 month and then
            bill a full quarter. Note that this feature should only be used
            where start dates are in the past AND the billing frequency is not
            monthly
          type: boolean
          default: false
        externalOrderReference:
          type: string
          description: Unique reference for the external order. Buyer's side reference
          minLength: 0
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        externalNetworkOrderReference:
          type: string
          description: Unique reference for the external order. Seller's side reference
          minLength: 0
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        pendingEndDate:
          description: Inflight order pending end date
          type: string
          format: date
        forceBilling:
          description: >-
            When this flag is set the rental product inventory will be rated if
            the start date is less than the billing run end date + the pricing
            frequency. So if you add an RPI to start at the start of the next
            bill run it will be rated in that bill run rather than in the next.
            The default value, if not specified, is defined by the contract
            owner's forceBillingDefault flag. If you specify just the
            forceBilling = true then this is the same as forceBillPeriods = 1
            and if you specify the forceBilling = false then this is the same as
            forceBillPeriods = 0
          type: boolean
        forceBillPeriods:
          description: >-
            Number of bill periods to force. ForceBillPeriods is ignored when
            forceBilling is false
          example: 1
          minimum: 0
          maximum: 731
          type: integer
          format: int32
        invoiceGroupTagLabelId:
          description: >-
            Invoice group tag label identifier. An optional grouping identifier
            when combined with a value for mid-month bill-immediately rental
            charges. Charges with the same invoice group tag will be invoiced
            together, generating one invoice per unique tag. Both labelId and
            value must be provided together
          type: integer
          format: int32
          x-si-validation: '@ValidId'
          example: 1
        invoiceGroupTagValue:
          description: >-
            Invoice group tag value. An optional grouping identifier when
            combined with a label for mid-month rental bill-immediately charges.
            Charges with the same invoice group tag will be invoiced together,
            generating one invoice per unique tag. Maximum 255 characters,
            cannot be empty or whitespace only
          type: string
          minLength: 1
          maxLength: 255
          pattern: \S.*
          example: Sales Division
        installationAddress:
          $ref: '#/components/schemas/Address'
        customFields:
          type: array
          items:
            $ref: '#/components/schemas/CustomField'
        openBillRunNetPrice:
          readOnly: true
          description: >-
            net price for RPI in the open bill run. This is in the major
            currency unit (i.e. pounds for GBP, euros for EUR, dollars for USD)
          type: number
          example: 10.5
        openBillRunGrossPrice:
          readOnly: true
          description: >-
            gross price for RPI in the open bill run. This is in the major
            currency unit (i.e. pounds for GBP, euros for EUR, dollars for USD)
          type: number
          example: 10.5
        currencyId:
          description: Currency Id
          readOnly: true
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
    ProvisioningDetails:
      required:
        - rentalProductInventoryId
        - status
      type: object
      properties:
        id:
          description: Provisioning details identifier
          type: integer
          readOnly: true
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        status:
          $ref: '#/components/schemas/ProvisioningStatus'
        smartBarStatus:
          $ref: '#/components/schemas/ProvisioningStatus'
        internationalBarStatus:
          $ref: '#/components/schemas/ProvisioningStatus'
        subscriptionId:
          type: string
          description: Subscription id
          maxLength: 40
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        rentalProductInventoryId:
          description: Rental product inventory identifier
          type: integer
          readOnly: true
          format: int64
          x-si-validation: '@ValidId'
          example: 1
    AdhocInventory:
      required:
        - siteId
        - name
        - sellPrice
        - quantity
        - rentalProductCategoryId
        - taxBandId
        - supplierAccountId
      type: object
      x-si-no-change-allowed-in-finalised-bill-run: >
        fields = { "siteId", "name", "buyPrice", "sellPrice", "billImmediately",
        "isCredit", "paid", "paymentTerms", "paymentType", "quantity",
        "rentalProductCategoryId", "taxBandId", "nominalCode",
        "supplierAccountId" }
      x-si-class-validation: |
        @RequiredWhen.List({
          @RequiredWhen(fieldName="billImmediately", fieldValue="true", dependFieldName="paymentTerms"),
          @RequiredWhen(fieldName="billImmediately", fieldValue="true", dependFieldName="paymentType"),
          @RequiredWhen(fieldName="isCredit", fieldValue="true", dependFieldName="billImmediately", dependFieldValue="true")
        })
        @NotAllowedWhen.List({
          @NotAllowedWhen(fieldName="billImmediately", fieldValue="false", dependFieldName="paymentType"),
          @NotAllowedWhen(fieldName="billImmediately", fieldValue="false", dependFieldName="paymentTerms"),        
          @NotAllowedWhen(fieldName="paid", fieldValue="true", dependFieldName="paymentTerms"),
          @NotAllowedWhen(fieldName="paid", fieldValue="true", dependFieldName="paymentType"),
          @NotAllowedWhen(fieldName="isCredit", fieldValue="false", dependFieldName="creditReason")
        })
      properties:
        id:
          description: Ad hoc inventory identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        siteId:
          description: Site identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        name:
          type: string
          description: Name
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        supplierAccountId:
          description: Supplier account identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
        buyPrice:
          description: Buy price
          type: number
        sellPrice:
          description: Sell Price
          type: number
        billImmediately:
          description: Bill immediately
          type: boolean
          default: false
        isCredit:
          description: Raise a credit note (requires billImmediately = true)
          type: boolean
          default: false
        creditReason:
          type: string
          description: Reason for credit
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        paid:
          description: Is already paid?
          type: boolean
          default: false
        paymentTerms:
          description: Payment terms in days
          type: integer
          format: int32
        paymentType:
          $ref: '#/components/schemas/PaymentMethod'
        quantity:
          description: Quantity
          type: number
        rentalProductCategoryId:
          description: Rental product category Id
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        taxBandId:
          description: Tax band identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        nominalCode:
          description: Nominal code
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[\w\p{L}\s%£@&#=':;,`’|!_—–()/\-+.?*$\[\]€^{}<>~]*$
          example: SALES-01QTR2
        billRunId:
          type: integer
          description: Bill run identifier
          format: int64
          readOnly: true
          example: 1
        adhocBillRunId:
          type: integer
          description: Adhoc bill run identifier (if billed immediately)
          format: int64
          readOnly: true
          example: 1
        invoiceGroupTagLabelId:
          description: >-
            Invoice group tag label identifier. An optional grouping identifier
            when combined with a value for mid-month bill-immediately adhoc
            charges. Charges with the same invoice group tag will be invoiced
            together, generating one invoice per unique tag. Both labelId and
            value must be provided together
          type: integer
          format: int32
          x-si-validation: '@ValidId'
          example: 1
        invoiceGroupTagValue:
          description: >-
            Invoice group tag value. An optional grouping identifier when
            combined with a label for mid-month adhoc bill-immediately charges.
            Charges with the same invoice group tag will be invoiced together,
            generating one invoice per unique tag. Maximum 255 characters,
            cannot be empty or whitespace only
          type: string
          minLength: 1
          maxLength: 255
          pattern: \S.*
          example: Sales Division
    ProductReference:
      required:
        - productReference
        - startDate
      type: object
      x-si-no-change-allowed-in-finalised-bill-run: |
        fields = { "startDate" }
      x-si-only-billrun-owner-can-change-in-closed-bill-run: |
        fields = { "primary", "startDate" }
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Product reference identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        productReference:
          type: string
          description: >-
            Product reference. Extra validations may be applied depending on
            product configurations.
          minLength: 1
          maxLength: 100
        primary:
          description: True if product reference is primary (main billing number)
          type: boolean
          default: true
        label:
          type: string
          description: Product reference
          minLength: 1
          maxLength: 500
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        startDate:
          description: Start date
          type: string
          format: date
        endDate:
          description: End date
          type: string
          format: date
        userId:
          type: string
          description: User Id
          minLength: 0
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        userEmail:
          type: string
          description: User email address
          minLength: 0
          maxLength: 255
          pattern: >-
            [a-zA-Z0-9.!#$%&'\*\+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*
        costCentreCode:
          type: string
          description: Cost centre code
          minLength: 0
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        departmentCode:
          type: string
          description: Department code
          minLength: 0
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        notes:
          type: string
          description: Notes
          minLength: 1
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
    PageParam:
      description: Page of results to show
      minimum: 1
      type: integer
      format: int32
      example: 1
    ResultsPerPageParam:
      description: Results to return per page
      maximum: 1000
      minimum: 1
      type: integer
      format: int32
      example: 100
    SortParam:
      description: >-
        Comma-delimited list of the fields to sort by - defaults to ascending
        order, suffix :desc to change
      example: id,name | name:desc
      type: string
    FieldsParam:
      description: >-
        Comma-delimited list of the field(s) to return if only a subset is
        required
      example: id,name
      type: string
    IdFilterParam:
      description: Filter by this numeric id value
      example: '0'
      type: string
    DateFilterParam:
      description: >-
        Filter by this date value where value can optionally be prefixed
        (gt:|lt:|gtn:|gen:)
      example: yyyy-MM-dd | lt:yyyy-MM-dd | gt:yyyy-MM-dd | gtn:yyyy-MM-dd
      type: string
    StringFilterParam:
      description: >-
        Filter by this string value where value can optionally be prefixed
        (in:|like:)
      example: xyz | in:x,y | like:xyz
      type: string
    CountryCode:
      description: ISO 3166 alpha-2 code representing country
      type: string
      minLength: 2
      maxLength: 2
      pattern: '[A-Z]{2}'
      example: GB
    Address:
      required:
        - address1
        - town
        - postcode
        - country
      type: object
      properties:
        id:
          type: integer
          description: Internal identifier for address entry
          readOnly: true
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        businessName:
          type: string
          description: Business name
          minLength: 0
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        address1:
          type: string
          description: Address line 1
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        address2:
          type: string
          description: Address line 2
          minLength: 0
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        address3:
          type: string
          description: Address line 3
          minLength: 0
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        town:
          type: string
          description: Town
          minLength: 1
          maxLength: 50
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        county:
          type: string
          description: County
          minLength: 0
          maxLength: 30
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        postcode:
          type: string
          description: Postcode
          minLength: 0
          maxLength: 20
          pattern: '[a-zA-Z0-9\p{L}@.\-\+_\s]+'
        country:
          $ref: '#/components/schemas/CountryCode'
    CustomField:
      required:
        - label
        - value
      type: object
      properties:
        id:
          description: Custom field identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        label:
          type: string
          description: Custom field label
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        value:
          type: string
          description: Custom field value
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
    BooleanFilterParam:
      description: Filter by this boolean value (true or false)
      example: true | false
      type: string
    ProvisioningStatus:
      description: Indicates the current status of the provisioned rental product inventory
      type: string
      enum:
        - INACTIVE
        - ACTIVE
        - ACTIVE_BUT_PORTING
        - SUSPENDED
        - PENDING
        - PENDING_EXTENDED
        - SUCCESS
        - ERROR
        - TERMINATED
    PaymentMethod:
      description: Payment method
      type: string
      enum:
        - CHEQUE
        - DIRECT_DEBIT
        - CANCELLED_DD
        - CANCELLED_CARD
        - CREDIT_CARD
        - PAYPAL
        - BACS
        - POST_OFFICE_PAYMENT_CARD
        - EZYPAY
        - GO_CARDLESS
        - GC_INSTANT_BANK_PAYMENTS
        - STRIPE
        - STRIPE_CARD
        - STRIPE_DD
        - FINASTRA
        - FAST_PAY
        - OTHER
    IdParam:
      description: Identifier
      minimum: 1
      type: integer
      format: int64
      example: 1
    PatchDocument:
      description: A JSONPatch document as defined by RFC 6902
      required:
        - op
        - path
      type: object
      properties:
        op:
          type: string
          description: The JSON Patch operation to be performed
          x-si-exclude: true
          enum:
            - add
            - remove
            - replace
            - move
            - copy
            - test
        path:
          type: string
          description: A JSON-Pointer
        value:
          type: object
          properties: {}
          description: The value to be used within the operations
        from:
          type: string
          description: A string containing a JSON Pointer value
    PatchRequest:
      type: array
      description: >-
        JSON Patch is a format for describing changes to a JSON document as
        specified in RFC 6902. Refer to [jsonpatch.com](http://jsonpatch.com/)
        for more information
      items:
        $ref: '#/components/schemas/PatchDocument'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  parameters:
    page:
      name: page
      in: query
      description: Page of results to show
      schema:
        $ref: '#/components/schemas/PageParam'
      required: true
    pageSize:
      name: pageSize
      description: Results to return per page
      in: query
      schema:
        $ref: '#/components/schemas/ResultsPerPageParam'
      required: true
    sort:
      name: sort
      in: query
      description: >-
        Comma-delimited list of the fields to sort by - defaults to ascending
        order, suffix :desc to change
      schema:
        $ref: '#/components/schemas/SortParam'
      required: false
    fields:
      name: fields
      in: query
      description: >-
        Comma-delimited list of the field(s) to return if only a subset is
        required
      schema:
        $ref: '#/components/schemas/FieldsParam'
      required: false
