openapi: 3.0.1
info:
  title: Elevate Pricing Assignment API
  description: >
    ### Customer and Site Pricing Assignment


    Provides read & write access to customer, site and inventory level pricing
    assignments including price overrides


    #### Rental and Usage Rate Cards


    Rental and Usage rate cards can be assigned at Customer, Site or Usage
    Inventory level


    * Rate cards at Customer level will apply to all sites and product
    inventories under the customer

    * Rate cards at Site level will override any rate card assigned at Customer
    level - the product inventories within this Site will use the assigned rate
    card

    * Rate cards at Inventory level override any rate card assigned at Customer
    or Site level; the individual product inventory will use the assigned rate
    card


    #### Inclusive Usage Plans


    Inclusive Usage plans can be assigned at Customer, Site or Usage Product
    Inventory level


    * Plans at Customer level will be shared between Sites for that Customer -
    e.g. 1000 minutes would be shared between the Sites

    * Plans can be added at Site level to just apply to that Site - this is in
    addition to any shared plan set at Customer level

    * Plans can be added at UPI level to just apply to that inventory item -
    this is in addition to any shared plan(s) set at Customer or Site level


    #### Rental and Usage Rate Overrides


    Rate overrides are the last pricing assignment level - they will override
    any rates that are set on the Rental or Usage rate card that is assigned

    Some examples;


    * A Usage rate override is set against a Customer - Sites belonging to this
    Customer will inherit the override regardless of the Usage rate card
    assigned

    * A Rental rate card is assigned at Site level and a Rental Rate Override is
    set for a product - the override price will overrule the price in the rate
    card for that product
  version: '1.17'
servers:
  - url: https://rest.elevatebilling.com/v1
tags:
  - name: usage-rate-card-assignments
    description: >-
      Usage rate cards contain the usage pricing structure - they can be
      assigned at Customer, Site or Usage Product Inventory level (UPI)
  - name: rental-rate-card-assignments
    description: >-
      Rental rate cards contain the rental pricing structure - they can be
      assigned at Customer, Site or Rental Product Inventory level (RPI)
  - name: inclusive-usage-plan-assignments
    description: >-
      Inclusive usage plans are an inclusive bundle assigned at Customer, Site
      or Usage Inventory level
  - name: usage-rate-overrides
    description: >-
      Usage rate overrides can be set at Customer, Site or Usage Inventory level
      to override the pricing in the rate card
  - name: rental-rate-overrides
    description: >-
      Rental rate overrides can be set at Customer, Site or Rental Inventory
      level to override the pricing in the rate card
  - name: buy-rental-rate-overrides
    description: >-
      Buy rental rate overrides can be set at Inventory level to override the
      pricing in the buy rate card
  - name: rental-discount-plan-assignments
    description: >-
      Rental discount plan assignments can be assigned at Customer, Site or
      Rental Product Inventory level
paths:
  /usage-rate-card-assignments:
    get:
      tags:
        - usage-rate-card-assignments
      summary: Get a list of usage rate card assignments
      operationId: getUsageRateCardAssignments
      x-si-permissions:
        - VIEW_CUSTOMER_USAGE_RATE_CARD
        - VIEW_SITE_USAGE_RATE_CARD
        - VIEW_INVENTORY_USAGE_RATE_CARD
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductInventoryId
          in: query
          description: Filter by usage product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageRateCardId
          in: query
          description: Filter by usage rate card
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UsageRateCardAssignment'
        '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:
        - usage-rate-card-assignments
      summary: Create a new usage rate card assignment
      operationId: createUsageRateCardAssignment
      x-si-permissions:
        - UPDATE_CUSTOMER_USAGE_RATE_CARD
        - UPDATE_SITE_USAGE_RATE_CARD
        - UPDATE_INVENTORY_USAGE_RATE_CARD
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New usage rate card assignment
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageRateCardAssignment'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRateCardAssignment'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRateCardAssignment'
        '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-rate-card-assignments
      summary: Check if usage rate card assignment exists
      operationId: checkUsageRateCardAssignment
      x-si-permissions:
        - VIEW_CUSTOMER_USAGE_RATE_CARD
        - VIEW_SITE_USAGE_RATE_CARD
        - VIEW_INVENTORY_USAGE_RATE_CARD
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductInventoryId
          in: query
          description: Filter by usage product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageRateCardId
          in: query
          description: Filter by usage rate card
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product
          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
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-rate-card-assignments/{assignmentLevel}/{usage_rate_card_assignment_id}:
    patch:
      tags:
        - usage-rate-card-assignments
      summary: Update a usage rate card assignment
      operationId: updateUsageRateCardAssignment
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_CUSTOMER_USAGE_RATE_CARD
        - UPDATE_SITE_USAGE_RATE_CARD
        - UPDATE_INVENTORY_USAGE_RATE_CARD
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be updated - CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: usage_rate_card_assignment_id
          in: path
          description: Usage rate card assignment 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:
              EndDateAssignment:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRateCardAssignment'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - usage-rate-card-assignments
      summary: Delete a usage rate card assignment
      description: Can only be done if not included in a finalised bill run
      operationId: deleteUsageRateCardAssignment
      x-si-permissions:
        - UPDATE_CUSTOMER_USAGE_RATE_CARD
        - UPDATE_SITE_USAGE_RATE_CARD
        - UPDATE_INVENTORY_USAGE_RATE_CARD
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be deleted - CUSTOMER, SITE or INVENTORY
          required: true
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: usage_rate_card_assignment_id
          in: path
          description: Usage rate card assignment identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-rate-card-assignments:
    get:
      tags:
        - rental-rate-card-assignments
      summary: Get a list of rental rate card assignments
      operationId: getRentalRateCardAssignments
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_RATE_CARD
        - VIEW_SITE_RENTAL_RATE_CARD
        - VIEW_INVENTORY_RENTAL_RATE_CARD
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalRateCardId
          in: query
          description: Filter by rental rate card
          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: rentalProductId
          in: query
          description: Filter by rental product
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RentalRateCardAssignment'
        '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-rate-card-assignments
      summary: Create a new rental rate card assignment
      operationId: createRentalRateCardAssignment
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_RATE_CARD
        - UPDATE_SITE_RENTAL_RATE_CARD
        - UPDATE_INVENTORY_RENTAL_RATE_CARD
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New rental rate card assignment
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalRateCardAssignment'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalRateCardAssignment'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalRateCardAssignment'
        '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-rate-card-assignments
      summary: Check if rental rate card assignment exists
      operationId: checkRentalRateCardAssignment
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_RATE_CARD
        - VIEW_SITE_RENTAL_RATE_CARD
        - VIEW_INVENTORY_RENTAL_RATE_CARD
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalRateCardId
          in: query
          description: Filter by rental rate card
          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: rentalProductId
          in: query
          description: Filter by rental product
          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
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-rate-card-assignments/{assignmentLevel}/{rental_rate_card_assignment_id}:
    patch:
      tags:
        - rental-rate-card-assignments
      summary: Update a rental rate card assignment
      operationId: updateRentalRateCardAssignment
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_RATE_CARD
        - UPDATE_SITE_RENTAL_RATE_CARD
        - UPDATE_INVENTORY_RENTAL_RATE_CARD
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be updated - CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: rental_rate_card_assignment_id
          in: path
          description: Rental rate card assignment 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:
              EndDateAssignment:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalRateCardAssignment'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - rental-rate-card-assignments
      summary: Delete a rental rate card assignment
      description: Can only be done if not included in a finalised bill run
      operationId: deleteRentalRateCardAssignment
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_RATE_CARD
        - UPDATE_SITE_RENTAL_RATE_CARD
        - UPDATE_INVENTORY_RENTAL_RATE_CARD
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be deleted - CUSTOMER, SITE or INVENTORY
          required: true
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: rental_rate_card_assignment_id
          in: path
          description: Rental rate card assignment identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /inclusive-usage-plan-assignments:
    get:
      tags:
        - inclusive-usage-plan-assignments
      summary: Get a list of inclusive usage plan assignments
      operationId: getInclusiveUsagePlanAssignments
      x-si-permissions:
        - VIEW_CUSTOMER_INCLUSIVE_USAGE_PLAN
        - VIEW_SITE_INCLUSIVE_USAGE_PLAN
        - VIEW_INVENTORY_INCLUSIVE_USAGE_PLAN
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductInventoryId
          in: query
          description: Filter by usage product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: inclusiveUsagePlanId
          in: query
          description: Filter by inclusive usage plan
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        '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:
        - inclusive-usage-plan-assignments
      summary: Create a new inclusive usage plan assignment
      operationId: createInclusiveUsagePlanAssignment
      x-si-requires-permission-to-create: >
        entityFields = { "customerId", "siteId", "usageProductInventoryId",
        "inclusiveUsagePlanId" } , allowFinalisedChanged = true
      x-si-permissions:
        - UPDATE_CUSTOMER_INCLUSIVE_USAGE_PLAN
        - UPDATE_SITE_INCLUSIVE_USAGE_PLAN
        - UPDATE_INVENTORY_INCLUSIVE_USAGE_PLAN
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New inclusive usage plan assignment
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        '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:
        - inclusive-usage-plan-assignments
      summary: Check if inclusive usage plan assignment exists
      operationId: checkInclusiveUsagePlanAssignment
      x-si-permissions:
        - VIEW_CUSTOMER_INCLUSIVE_USAGE_PLAN
        - VIEW_SITE_INCLUSIVE_USAGE_PLAN
        - VIEW_INVENTORY_INCLUSIVE_USAGE_PLAN
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductInventoryId
          in: query
          description: Filter by usage product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: inclusiveUsagePlanId
          in: query
          description: Filter by inclusive usage plan
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product
          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
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /inclusive-usage-plan-assignments/{assignmentLevel}/{inclusive_usage_plan_assignment_id}:
    patch:
      tags:
        - inclusive-usage-plan-assignments
      summary: Update an inclusive usage plan assignment
      operationId: updateInclusiveUsagePlanAssignment
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_CUSTOMER_INCLUSIVE_USAGE_PLAN
        - UPDATE_SITE_INCLUSIVE_USAGE_PLAN
        - UPDATE_INVENTORY_INCLUSIVE_USAGE_PLAN
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be updated - CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: inclusive_usage_plan_assignment_id
          in: path
          description: Inclusive usage plan assignment 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:
              EndDateAssignment:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - inclusive-usage-plan-assignments
      summary: Delete an inclusive usage plan assignment
      description: Delete an inclusive usage plan assignment
      operationId: deleteInclsiveUsagePlanAssignment
      x-si-permissions:
        - UPDATE_CUSTOMER_INCLUSIVE_USAGE_PLAN
        - UPDATE_SITE_INCLUSIVE_USAGE_PLAN
        - UPDATE_INVENTORY_INCLUSIVE_USAGE_PLAN
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be deleted - CUSTOMER, SITE or INVENTORY
          required: true
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: inclusive_usage_plan_assignment_id
          in: path
          description: Inclusive usage plan assignment identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-rate-overrides:
    get:
      tags:
        - usage-rate-overrides
      summary: Get a list of usage overrides
      operationId: getUsageRateOverrides
      x-si-permissions:
        - VIEW_CUSTOMER_USAGE_OVERRIDE
        - VIEW_SITE_USAGE_OVERRIDE
        - VIEW_INVENTORY_USAGE_OVERRIDE
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductInventoryId
          in: query
          description: Filter by usage product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UsageRateOverride'
        '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:
        - usage-rate-overrides
      summary: Create a new usage rate override
      operationId: createUsageRateOverride
      x-si-permissions:
        - UPDATE_CUSTOMER_USAGE_OVERRIDE
        - UPDATE_SITE_USAGE_OVERRIDE
        - UPDATE_INVENTORY_USAGE_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New usage rate override
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageRateOverride'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRateOverride'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRateOverride'
        '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-rate-overrides
      summary: Check if usage rate override exists
      operationId: checkUsageRateOverride
      x-si-permissions:
        - VIEW_CUSTOMER_USAGE_OVERRIDE
        - VIEW_SITE_USAGE_OVERRIDE
        - VIEW_INVENTORY_USAGE_OVERRIDE
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductInventoryId
          in: query
          description: Filter by usage product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product
          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
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-rate-overrides/{assignmentLevel}/{usage_rate_override_id}:
    patch:
      tags:
        - usage-rate-overrides
      summary: Update a usage rate override
      operationId: updateUsageRateOverride
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
        - /usageProductId
        - /supplierId
        - /chargeGroupId
        - /variableChargeUnitSize
        - /quantityRoundingIncrement
        - /appliesToISDNOnly
        - /(peak|offPeak|weekend)Value
        - /(peak|offPeak|weekend)MinimumCharge
        - /(peak|offPeak|weekend)InitialCharge
        - /(peak|offPeak|weekend)InitialChargePeriod
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_CUSTOMER_USAGE_OVERRIDE
        - UPDATE_SITE_USAGE_OVERRIDE
        - UPDATE_INVENTORY_USAGE_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be updated - CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: usage_rate_override_id
          in: path
          description: Usage rate override 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:
              EndDateOverride:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
              UpdateOffPeakValue:
                value:
                  - op: replace
                    path: /offPeakValue
                    value: '15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageRateOverride'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - usage-rate-overrides
      summary: Delete a usage rate override
      description: Can only be done if not included in a finalised bill run
      operationId: deleteUsageRateOverride
      x-si-permissions:
        - UPDATE_CUSTOMER_USAGE_OVERRIDE
        - UPDATE_SITE_USAGE_OVERRIDE
        - UPDATE_INVENTORY_USAGE_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be deleted - CUSTOMER, SITE or INVENTORY
          required: true
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: usage_rate_override_id
          in: path
          description: Usage rate override identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-rate-overrides:
    get:
      tags:
        - rental-rate-overrides
      summary: Get a list of rental overrides
      operationId: getRentalRateOverrides
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_OVERRIDE
        - VIEW_SITE_RENTAL_OVERRIDE
        - VIEW_INVENTORY_RENTAL_OVERRIDE
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          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: rentalProductId
          in: query
          description: Filter by rental product
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RentalRateOverride'
        '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-rate-overrides
      summary: Create a new rental rate override
      operationId: createRentalRateOverride
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_OVERRIDE
        - UPDATE_SITE_RENTAL_OVERRIDE
        - UPDATE_INVENTORY_RENTAL_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New rental rate override
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalRateOverride'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalRateOverride'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalRateOverride'
        '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-rate-overrides
      summary: Check if rental rate override exists
      operationId: checkRentalRateOverride
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_OVERRIDE
        - VIEW_SITE_RENTAL_OVERRIDE
        - VIEW_INVENTORY_RENTAL_OVERRIDE
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          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: rentalProductId
          in: query
          description: Filter by rental product
          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
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-rate-overrides/{assignmentLevel}/{rental_rate_override_id}:
    patch:
      tags:
        - rental-rate-overrides
      summary: Update a rental rate override
      operationId: updateRentalRateOverride
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
        - /price
        - /rentalRate(Type|PriceType|Frequency)
        - /periodsInAdvance
        - /applyThisToChildren
        - /showOnInvoice
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_OVERRIDE
        - UPDATE_SITE_RENTAL_OVERRIDE
        - UPDATE_INVENTORY_RENTAL_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be updated - CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: rental_rate_override_id
          in: path
          description: Rental rate override 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:
              EndDateOverride:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalRateOverride'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - rental-rate-overrides
      summary: Delete a rental rate override
      description: Can only be done if not included in a finalised bill run
      operationId: deleteRentalRateOverride
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_OVERRIDE
        - UPDATE_SITE_RENTAL_OVERRIDE
        - UPDATE_INVENTORY_RENTAL_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be deleted - CUSTOMER, SITE or INVENTORY
          required: true
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: rental_rate_override_id
          in: path
          description: Rental rate override identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /buy-rental-rate-overrides:
    get:
      tags:
        - buy-rental-rate-overrides
      summary: Get a list of buy rental overrides
      operationId: getBuyRentalRateOverrides
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_OVERRIDE
        - VIEW_SITE_RENTAL_OVERRIDE
        - VIEW_INVENTORY_RENTAL_OVERRIDE
      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
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BuyRentalRateOverride'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    post:
      tags:
        - buy-rental-rate-overrides
      summary: Create a new buy rental rate override
      operationId: createBuyRentalRateOverride
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_OVERRIDE
        - UPDATE_SITE_RENTAL_OVERRIDE
        - UPDATE_INVENTORY_RENTAL_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New buy rental rate override
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BuyRentalRateOverride'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuyRentalRateOverride'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuyRentalRateOverride'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    head:
      tags:
        - buy-rental-rate-overrides
      summary: Check if buy rental rate override exists
      operationId: checkBuyRentalRateOverride
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_OVERRIDE
        - VIEW_SITE_RENTAL_OVERRIDE
        - VIEW_INVENTORY_RENTAL_OVERRIDE
      security:
        - bearerAuth: []
      parameters:
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          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
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /buy-rental-rate-overrides/{buy_rental_rate_override_id}:
    patch:
      tags:
        - buy-rental-rate-overrides
      summary: Update a buy rental rate override
      operationId: updateBuyRentalRateOverride
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
        - /price
        - /rentalRate(Type|PriceType|Frequency)
        - /periodsInAdvance
      x-si-requires-permission-to-update: true
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_OVERRIDE
        - UPDATE_SITE_RENTAL_OVERRIDE
        - UPDATE_INVENTORY_RENTAL_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: buy_rental_rate_override_id
          in: path
          description: Buy rental rate override 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:
              EndDateOverride:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BuyRentalRateOverride'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - buy-rental-rate-overrides
      summary: Delete a buy rental rate override
      description: Can only be done if not included in a finalised bill run
      operationId: deleteBuyRentalRateOverride
      x-si-permissions:
        - UPDATE_CUSTOMER_RENTAL_OVERRIDE
        - UPDATE_SITE_RENTAL_OVERRIDE
        - UPDATE_INVENTORY_RENTAL_OVERRIDE
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: buy_rental_rate_override_id
          in: path
          description: Buy rental rate override identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-discount-plan-assignments:
    get:
      tags:
        - rental-discount-plan-assignments
      summary: Get a list of rental discount plan assignments
      operationId: getRentalDiscountPlanAssignments
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_DISCOUNT
        - VIEW_SITE_RENTAL_DISCOUNT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalDiscountPlanId
          in: query
          description: Filter by rental discount plan
          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
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        '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-discount-plan-assignments
      summary: Create a new rental discount plan assignment
      description: >
        Creates a new rental discount plan assignment at Customer, Site or
        Inventory level.

        Note: Inventory level assignments are only allowed if a Site or Customer
        level assignment already exists for the same rental discount plan.
      operationId: createRentalDiscountPlanAssignment
      x-si-permissions:
        - UPDATE_DISCOUNT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New rental discount plan assignment
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        '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-discount-plan-assignments
      summary: Check if rental discount plan assignment exists
      operationId: checkRentalDiscountPlanAssignment
      x-si-response-headers: true
      x-si-permissions:
        - VIEW_CUSTOMER_RENTAL_DISCOUNT
        - VIEW_SITE_RENTAL_DISCOUNT
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: query
          description: Required assignment level - CUSTOMER, SITE or INVENTORY
          example: CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: customerId
          in: query
          description: Filter by customer
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: siteId
          in: query
          description: Filter by site
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalProductInventoryId
          in: query
          description: Filter by rental product inventory
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: rentalDiscountPlanId
          in: query
          description: Filter by rental discount plan
          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
      responses:
        '200':
          description: Exists
          content: {}
          headers:
            X-Total-Count:
              schema:
                type: integer
                description: >-
                  Total number of rental discount plan assignments matching the
                  filter criteria
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-discount-plan-assignments/{assignmentLevel}/{rental_discount_plan_assignment_id}:
    patch:
      tags:
        - rental-discount-plan-assignments
      summary: Update a rental discount plan assignment
      operationId: updateRentalDiscountPlanAssignment
      x-si-json-patch: true
      x-si-allow-patch:
        - /(start|end)Date
      x-si-permissions:
        - UPDATE_DISCOUNT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be updated - CUSTOMER, SITE or INVENTORY
          required: true
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: rental_discount_plan_assignment_id
          in: path
          description: Rental discount plan assignment 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:
              EndDateAssignment:
                value:
                  - op: replace
                    path: /endDate
                    value: '2049-07-15'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - rental-discount-plan-assignments
      summary: Delete a rental discount plan assignment
      description: Can only be done if not included in a finalised bill run
      operationId: deleteRentalDiscountPlanAssignment
      x-si-permissions:
        - UPDATE_DISCOUNT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: assignmentLevel
          in: path
          description: Assignment level to be deleted - CUSTOMER, SITE or INVENTORY
          required: true
          style: simple
          explode: false
          schema:
            type: string
            enum:
              - CUSTOMER
              - SITE
              - INVENTORY
        - name: rental_discount_plan_assignment_id
          in: path
          description: Rental discount plan assignment identifier
          required: true
          style: simple
          explode: false
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
components:
  schemas:
    UsageRateCardAssignment:
      type: object
      discriminator:
        propertyName: assignmentLevel
        mapping:
          CUSTOMER: '#/components/schemas/CustomerUsageRateCardAssignment'
          SITE: '#/components/schemas/SiteUsageRateCardAssignment'
          INVENTORY: '#/components/schemas/InventoryUsageRateCardAssignment'
      required:
        - assignmentLevel
        - usageRateCardId
        - startDate
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Usage rate card assignment identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        assignmentLevel:
          description: >-
            Rate cards can be assigned at customer, site or product inventory
            levels - use the appropriate level to determine which fields are
            required.
          type: string
          example: CUSTOMER, SITE or INVENTORY
        usageRateCardId:
          description: Usage rate card 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
    CustomerUsageRateCardAssignment:
      x-si-class-validation: |
        @RequiredWhen.List({
          @RequiredWhen(fieldName = "assignmentLevel", fieldValue = "CUSTOMER", dependFieldName = "assignmentType")
        })
      allOf:
        - $ref: '#/components/schemas/UsageRateCardAssignment'
        - type: object
          required:
            - customerId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "customerId", "usageRateCardId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "customerId", "usageRateCardId" }
          properties:
            customerId:
              description: Customer identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
            assignmentType:
              $ref: '#/components/schemas/UsageCardAssignmentType'
    SiteUsageRateCardAssignment:
      allOf:
        - $ref: '#/components/schemas/UsageRateCardAssignment'
        - type: object
          required:
            - siteId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "siteId", "usageRateCardId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "siteId", "usageRateCardId" }
          properties:
            siteId:
              description: Site identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
            acceptOverridesFromParents:
              description: >-
                Pricing can be assigned at customer, site or product inventory
                levels and could be a rate card assignment or override
                assignment. If set to true, this property allows overrides
                assigned at a higher point in the hierarchy to override prices
                set within this rate card.
              type: boolean
              default: true
    InventoryUsageRateCardAssignment:
      allOf:
        - $ref: '#/components/schemas/UsageRateCardAssignment'
        - type: object
          required:
            - usageProductInventoryId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "usageProductInventoryId", "usageRateCardId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "usageProductInventoryId", "usageRateCardId" }
          properties:
            usageProductInventoryId:
              description: UPI identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
            acceptOverridesFromParents:
              description: >-
                Pricing can be assigned at customer, site or product inventory
                levels and could be a rate card assignment or override
                assignment. If set to true, this property allows overrides
                assigned at a higher point in the hierarchy to override prices
                set within this rate card.
              type: boolean
              default: true
    RentalRateCardAssignment:
      type: object
      discriminator:
        propertyName: assignmentLevel
        mapping:
          CUSTOMER: '#/components/schemas/CustomerRentalRateCardAssignment'
          SITE: '#/components/schemas/SiteRentalRateCardAssignment'
          INVENTORY: '#/components/schemas/InventoryRentalRateCardAssignment'
      required:
        - assignmentLevel
        - rentalRateCardId
        - startDate
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Rental rate card assignment identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        assignmentLevel:
          description: >-
            Rate cards can be assigned at customer, site or product inventory
            levels - use the appropriate level to determine which fields are
            required.
          type: string
          example: CUSTOMER, SITE or INVENTORY
        rentalRateCardId:
          description: Rental rate card 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
    CustomerRentalRateCardAssignment:
      allOf:
        - $ref: '#/components/schemas/RentalRateCardAssignment'
        - type: object
          required:
            - customerId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "customerId", "rentalRateCardId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "customerId", "rentalRateCardId" }
          properties:
            customerId:
              description: Customer identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    SiteRentalRateCardAssignment:
      allOf:
        - $ref: '#/components/schemas/RentalRateCardAssignment'
        - type: object
          required:
            - siteId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "siteId", "rentalRateCardId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "siteId", "rentalRateCardId" }
          properties:
            siteId:
              description: Site identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    InventoryRentalRateCardAssignment:
      allOf:
        - $ref: '#/components/schemas/RentalRateCardAssignment'
        - type: object
          required:
            - rentalProductInventoryId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "rentalProductInventoryId", "rentalRateCardId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "rentalProductInventoryId", "rentalRateCardId" }
          properties:
            rentalProductInventoryId:
              description: UPI identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    InclusiveUsagePlanAssignment:
      type: object
      discriminator:
        propertyName: assignmentLevel
        mapping:
          CUSTOMER: '#/components/schemas/CustomerInclusiveUsagePlanAssignment'
          SITE: '#/components/schemas/SiteInclusiveUsagePlanAssignment'
          INVENTORY: '#/components/schemas/InventoryInclusiveUsagePlanAssignment'
      required:
        - assignmentLevel
        - inclusiveUsagePlanId
        - startDate
      x-si-no-change-allowed-in-finalised-bill-run: >
        fields = { "customerId", "siteId", "usageProductInventoryId",
        "inclusiveUsagePlanId" }
      x-si-only-billrun-owner-can-change-in-closed-bill-run: >
        fields = { "customerId", "siteId", "usageProductInventoryId",
        "inclusiveUsagePlanId" }
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Inclusive usage plan assignment identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        assignmentLevel:
          description: >-
            Inclusive usage plans can be assigned at customer, site or product
            inventory levels - use the appropriate level to determine which
            fields are required.
          type: string
          example: CUSTOMER, SITE or INVENTORY
        inclusiveUsagePlanId:
          description: Inclusive usage plan 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
    CustomerInclusiveUsagePlanAssignment:
      allOf:
        - $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        - type: object
          required:
            - customerId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "customerId", "inclusiveUsagePlanId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "customerId", "inclusiveUsagePlanId" }
          properties:
            customerId:
              description: Customer identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    SiteInclusiveUsagePlanAssignment:
      allOf:
        - $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        - type: object
          required:
            - siteId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "siteId", "inclusiveUsagePlanId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "siteId", "inclusiveUsagePlanId" }
          properties:
            siteId:
              description: Site identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    InventoryInclusiveUsagePlanAssignment:
      allOf:
        - $ref: '#/components/schemas/InclusiveUsagePlanAssignment'
        - type: object
          required:
            - usageProductInventoryId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "usageProductInventoryId", "inclusiveUsagePlanId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "usageProductInventoryId", "inclusiveUsagePlanId" }
          properties:
            usageProductInventoryId:
              description: UPI identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    UsageRateOverride:
      type: object
      discriminator:
        propertyName: assignmentLevel
        mapping:
          CUSTOMER: '#/components/schemas/CustomerUsageRateOverride'
          SITE: '#/components/schemas/SiteUsageRateOverride'
          INVENTORY: '#/components/schemas/InventoryUsageRateOverride'
      required:
        - assignmentLevel
        - usageProductId
        - chargeGroupId
        - variableChargeUnitSize
        - quantityRoundingIncrement
        - startDate
        - peakMinimumCharge
        - peakInitialCharge
        - peakInitialChargePeriod
        - offPeakMinimumCharge
        - offPeakInitialCharge
        - offPeakInitialChargePeriod
        - weekendMinimumCharge
        - weekendInitialCharge
        - weekendInitialChargePeriod
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Usage rate override identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        assignmentLevel:
          description: >-
            Rate overrides can be assigned at customer, site or product
            inventory levels - use the appropriate level to determine which
            fields are required.
          type: string
          example: CUSTOMER
        usageProductId:
          description: Usage product identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        supplierId:
          description: Supplier identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        chargeGroupId:
          description: Charge group identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        variableChargeUnitSize:
          description: Variable charge unit size
          type: integer
          format: int32
          minimum: 1
          example: 60
        quantityRoundingIncrement:
          description: Quantity rounding increment
          type: number
          minimum: 1
          example: 1
        startDate:
          description: Start date
          type: string
          format: date
        appliesToISDNOnly:
          description: Applies to ISDN calls only?
          type: boolean
          default: false
        endDate:
          description: End date
          type: string
          format: date
        peakValue:
          description: Peak value
          type: number
        offPeakValue:
          description: Off peak value
          type: number
        weekendValue:
          description: Weekend value
          type: number
        peakMinimumCharge:
          description: Peak minimum charge
          type: number
        offPeakMinimumCharge:
          description: Off peak minimum charge
          type: number
        weekendMinimumCharge:
          description: Weekend minimum charge
          type: number
        peakInitialCharge:
          description: Peak initial charge
          type: number
        offPeakInitialCharge:
          description: Off peak initial charge
          type: number
        weekendInitialCharge:
          description: Weekend initial charge
          type: number
        peakInitialChargePeriod:
          description: Peak initial charge period
          type: integer
          format: int32
        offPeakInitialChargePeriod:
          description: Off peak initial charge period
          type: integer
          format: int32
        weekendInitialChargePeriod:
          description: Weekend initial charge period
          type: integer
          format: int32
    CustomerUsageRateOverride:
      allOf:
        - $ref: '#/components/schemas/UsageRateOverride'
        - type: object
          required:
            - customerId
            - applyThisToChildren
          x-si-no-change-allowed-in-finalised-bill-run: >
            fields = { "customerId", "usageProductId", "supplierId",
            "chargeGroupId", "applyThisToChildren", "variableChargeUnitSize",
            "quantityRoundingIncrement", "peakValue", "peakMinimumCharge",
            "peakInitialCharge", "peakInitialChargePeriod", "offPeakValue",
            "offPeakMinimumCharge", "offPeakInitialCharge",
            "offPeakInitialChargePeriod", "weekendValue",
            "weekendMinimumCharge", "weekendInitialCharge",
            "weekendInitialChargePeriod" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: >
            fields = { "customerId", "usageProductId", "supplierId",
            "chargeGroupId", "applyThisToChildren", "variableChargeUnitSize",
            "quantityRoundingIncrement", "peakValue", "peakMinimumCharge",
            "peakInitialCharge", "peakInitialChargePeriod", "offPeakValue",
            "offPeakMinimumCharge", "offPeakInitialCharge",
            "offPeakInitialChargePeriod", "weekendValue",
            "weekendMinimumCharge", "weekendInitialCharge",
            "weekendInitialChargePeriod" }
          properties:
            customerId:
              description: Customer identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
            applyThisToChildren:
              description: Apply this override to children?
              type: boolean
              default: true
    SiteUsageRateOverride:
      allOf:
        - $ref: '#/components/schemas/UsageRateOverride'
        - type: object
          required:
            - siteId
            - applyThisToChildren
          x-si-no-change-allowed-in-finalised-bill-run: >
            fields = { "siteId", "usageProductId", "supplierId",
            "chargeGroupId", "applyThisToChildren", "variableChargeUnitSize",
            "quantityRoundingIncrement", "peakValue", "peakMinimumCharge",
            "peakInitialCharge", "peakInitialChargePeriod", "offPeakValue",
            "offPeakMinimumCharge", "offPeakInitialCharge",
            "offPeakInitialChargePeriod", "weekendValue",
            "weekendMinimumCharge", "weekendInitialCharge",
            "weekendInitialChargePeriod" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: >
            fields = { "siteId", "usageProductId", "supplierId",
            "chargeGroupId", "applyThisToChildren", "variableChargeUnitSize",
            "quantityRoundingIncrement", "peakValue", "peakMinimumCharge",
            "peakInitialCharge", "peakInitialChargePeriod", "offPeakValue",
            "offPeakMinimumCharge", "offPeakInitialCharge",
            "offPeakInitialChargePeriod", "weekendValue",
            "weekendMinimumCharge", "weekendInitialCharge",
            "weekendInitialChargePeriod" }
          properties:
            siteId:
              description: Site identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
            applyThisToChildren:
              description: Apply this override to children?
              type: boolean
              default: true
    InventoryUsageRateOverride:
      allOf:
        - $ref: '#/components/schemas/UsageRateOverride'
        - type: object
          required:
            - usageProductInventoryId
          x-si-no-change-allowed-in-finalised-bill-run: >
            fields = { "usageProductInventoryId", "usageProductId",
            "supplierId", "chargeGroupId", "applyThisToChildren",
            "variableChargeUnitSize", "quantityRoundingIncrement", "peakValue",
            "peakMinimumCharge", "peakInitialCharge", "peakInitialChargePeriod",
            "offPeakValue", "offPeakMinimumCharge", "offPeakInitialCharge",
            "offPeakInitialChargePeriod", "weekendValue",
            "weekendMinimumCharge", "weekendInitialCharge",
            "weekendInitialChargePeriod" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: >
            fields = { "usageProductInventoryId", "usageProductId",
            "supplierId", "chargeGroupId", "applyThisToChildren",
            "variableChargeUnitSize", "quantityRoundingIncrement", "peakValue",
            "peakMinimumCharge", "peakInitialCharge", "peakInitialChargePeriod",
            "offPeakValue", "offPeakMinimumCharge", "offPeakInitialCharge",
            "offPeakInitialChargePeriod", "weekendValue",
            "weekendMinimumCharge", "weekendInitialCharge",
            "weekendInitialChargePeriod" }
          properties:
            usageProductInventoryId:
              description: UPI identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    RentalRateOverride:
      type: object
      discriminator:
        propertyName: assignmentLevel
        mapping:
          CUSTOMER: '#/components/schemas/CustomerRentalRateOverride'
          SITE: '#/components/schemas/SiteRentalRateOverride'
          INVENTORY: '#/components/schemas/InventoryRentalRateOverride'
      required:
        - assignmentLevel
        - price
        - rentalRatePriceType
        - startDate
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
        @RequiredWhen.List({
          @RequiredWhen(fieldName = "rentalRatePriceType", fieldValue = "RENTAL", dependFieldName = "rentalRateType"),
          @RequiredWhen(fieldName = "rentalRateType", fieldValue = "ADVANCE", dependFieldName = "periodsInAdvance"),
          @RequiredWhen(fieldName = "rentalRatePriceType", fieldValue = "RENTAL", dependFieldName = "rentalRateFrequency")
        })
      properties:
        id:
          description: Rental rate override identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        assignmentLevel:
          description: >-
            Rate overrides can be assigned at customer, site or product
            inventory levels - use the appropriate level to determine which
            fields are required.
          type: string
          example: CUSTOMER
        price:
          description: Price
          type: number
          minimum: -9999999
          maximum: 9999999
        rentalRatePriceType:
          $ref: '#/components/schemas/RentalRatePriceType'
        rentalRateType:
          description: Required when rentalRatePriceType is RENTAL
          $ref: '#/components/schemas/RentalRateType'
        periodsInAdvance:
          description: Required when rentalRateType is ADVANCE
          $ref: '#/components/schemas/PeriodsInAdvance'
        rentalRateFrequency:
          description: Required when rentalRatePriceType is RENTAL
          $ref: '#/components/schemas/RentalRateFrequency'
        startDate:
          description: Start date
          type: string
          format: date
        endDate:
          description: End date
          type: string
          format: date
        applyThisToChildren:
          description: Apply this override to children?
          type: boolean
          default: true
        showOnInvoice:
          description: Show on invoice?
          type: boolean
          default: true
    CustomerRentalRateOverride:
      allOf:
        - $ref: '#/components/schemas/RentalRateOverride'
        - type: object
          required:
            - customerId
            - rentalProductId
          x-si-no-change-allowed-in-finalised-bill-run: >
            fields = { "customerId", "rentalProductId", "price",
            "rentalRateType", "rentalRatePriceType", "periodsInAdvance",
            "rentalRateFrequency", "applyThisToChildren", "showOnInvoice" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: >
            fields = { "customerId", "rentalProductId", "price",
            "rentalRateType", "rentalRatePriceType", "periodsInAdvance",
            "rentalRateFrequency", "applyThisToChildren", "showOnInvoice" }
          properties:
            customerId:
              description: Customer 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
    SiteRentalRateOverride:
      allOf:
        - $ref: '#/components/schemas/RentalRateOverride'
        - type: object
          required:
            - siteId
            - rentalProductId
          x-si-no-change-allowed-in-finalised-bill-run: >
            fields = { "siteId", "rentalProductId", "price", "rentalRateType",
            "rentalRatePriceType", "periodsInAdvance", "rentalRateFrequency",
            "applyThisToChildren", "showOnInvoice" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: >
            fields = { "siteId", "rentalProductId", "price", "rentalRateType",
            "rentalRatePriceType", "periodsInAdvance", "rentalRateFrequency",
            "applyThisToChildren", "showOnInvoice" }
          properties:
            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
    InventoryRentalRateOverride:
      allOf:
        - $ref: '#/components/schemas/RentalRateOverride'
        - type: object
          required:
            - rentalProductInventoryId
          x-si-no-change-allowed-in-finalised-bill-run: >
            fields = { "rentalProductInventoryId", "rentalProductId", "price",
            "rentalRateType", "rentalRatePriceType", "periodsInAdvance",
            "rentalRateFrequency", "applyThisToChildren", "showOnInvoice" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: >
            fields = { "rentalProductInventoryId", "rentalProductId", "price",
            "rentalRateType", "rentalRatePriceType", "periodsInAdvance",
            "rentalRateFrequency", "applyThisToChildren", "showOnInvoice" }
          properties:
            rentalProductInventoryId:
              description: RPI identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    BuyRentalRateOverride:
      type: object
      required:
        - rentalProductInventoryId
        - price
        - rentalRatePriceType
        - startDate
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
        @RequiredWhen.List({
          @RequiredWhen(fieldName = "rentalRatePriceType", fieldValue = "RENTAL", dependFieldName = "rentalRateType"),
          @RequiredWhen(fieldName = "rentalRateType", fieldValue = "ADVANCE", dependFieldName = "periodsInAdvance"),
          @RequiredWhen(fieldName = "rentalRatePriceType", fieldValue = "RENTAL", dependFieldName = "rentalRateFrequency")
        })
      properties:
        id:
          description: Buy rental rate override identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        rentalProductInventoryId:
          type: integer
          description: Rental product inventory identifier
          format: int64
          example: 1
          x-si-validation: '@ValidId'
        price:
          description: Price
          type: number
          minimum: -9999999
          maximum: 9999999
        rentalRatePriceType:
          $ref: '#/components/schemas/RentalRatePriceType'
        rentalRateType:
          description: Required when rentalRatePriceType is RENTAL
          $ref: '#/components/schemas/RentalRateType'
        periodsInAdvance:
          description: Required when rentalRateType is ADVANCE
          $ref: '#/components/schemas/PeriodsInAdvance'
        rentalRateFrequency:
          description: Required when rentalRatePriceType is RENTAL
          $ref: '#/components/schemas/RentalRateFrequency'
        startDate:
          description: Start date
          type: string
          format: date
        endDate:
          description: End date
          type: string
          format: date
    RentalDiscountPlanAssignment:
      type: object
      discriminator:
        propertyName: assignmentLevel
        mapping:
          CUSTOMER: '#/components/schemas/CustomerRentalDiscountPlanAssignment'
          SITE: '#/components/schemas/SiteRentalDiscountPlanAssignment'
          INVENTORY: '#/components/schemas/InventoryRentalDiscountPlanAssignment'
      required:
        - assignmentLevel
        - rentalDiscountPlanId
        - startDate
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Rental discount plan assignment identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        assignmentLevel:
          description: >-
            Rental discount plans can be assigned at customer, site or product
            inventory levels - use the appropriate level to determine which
            fields are required. Note that inventory level assignments are only
            allowed if a site or customer level assignment already exists.
          type: string
          example: CUSTOMER, SITE or INVENTORY
        rentalDiscountPlanId:
          description: Rental discount plan 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
    CustomerRentalDiscountPlanAssignment:
      allOf:
        - $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        - type: object
          required:
            - customerId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "customerId", "rentalDiscountPlanId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "customerId", "rentalDiscountPlanId" }
          properties:
            customerId:
              description: Customer identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    SiteRentalDiscountPlanAssignment:
      allOf:
        - $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        - type: object
          required:
            - siteId
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "siteId", "rentalDiscountPlanId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "siteId", "rentalDiscountPlanId" }
          properties:
            siteId:
              description: Site identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    InventoryRentalDiscountPlanAssignment:
      description: >-
        Inventory level assignments are only allowed if a Site or Customer level
        assignment already exists for the same rental discount plan. Unlike
        Customer and Site level assignments, Inventory level assignments require
        an end date.
      allOf:
        - $ref: '#/components/schemas/RentalDiscountPlanAssignment'
        - type: object
          required:
            - rentalProductInventoryId
            - endDate
          x-si-no-change-allowed-in-finalised-bill-run: |
            fields = { "rentalProductInventoryId", "rentalDiscountPlanId" }
          x-si-only-billrun-owner-can-change-in-closed-bill-run: |
            fields = { "rentalProductInventoryId", "rentalDiscountPlanId" }
          properties:
            rentalProductInventoryId:
              description: Rental product inventory identifier
              type: integer
              format: int64
              x-si-validation: '@ValidId'
              example: 1
    UsageCardAssignmentType:
      description: >
        Default is INVOICE only - ADDITIONAL rate card assignments are included
        in commission calculations. 

        This field is required for CUSTOMER level rate card assignments - remove
        the field from your request to use the default value or specify a valid
        one from the options given.
      type: string
      enum:
        - INVOICE
        - ADDITIONAL
      default: INVOICE
    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
    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'
    RentalRatePriceType:
      description: Rental price type - recurring rental or one off?
      type: string
      enum:
        - RENTAL
        - ONEOFF
    RentalRateType:
      description: Rental rate type. Required when rentalRatePriceType is RENTAL
      type: string
      enum:
        - ADVANCE
        - ARREARS
    PeriodsInAdvance:
      description: >-
        Number of periods in advance (i.e. Months) for rentals. Required when
        rentalRateType is ADVANCE
      type: string
      enum:
        - STANDARD
        - ADVANCEDPLUSONEMONTH
    RentalRateFrequency:
      description: Frequency of rental. Required when rentalRatePriceType is RENTAL
      type: string
      enum:
        - DAILY
        - WEEKLY
        - MONTHLY
        - YEARLY
        - QUARTERLY
        - SIXMONTHS
        - TWENTYFOURMONTHS
  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
