openapi: 3.0.1
info:
  title: Elevate Products API
  description: >
    ### Product Management

    Provides read & write access to usage and rental product entities


    #### Definitions

    * Rental Product - a product or service that is billed on a fixed charge;
    for example, a broadband service, connection or site visit

    * Usage Product - a product that is billed based on it's usage, such as
    calls or data; these typically fall into one of the following categories
    within Elevate; outbound such as CPS/IDA, Mobile or VoIP; and Inbound
  version: '2.13'
servers:
  - url: https://rest.elevatebilling.com/v2
tags:
  - name: usage-products
    description: Usage products represent products that are billed based on usage
  - name: rental-products
    description: >-
      Rental products represent a product or service that is billed on a fixed
      charge
  - name: custom-fields
    description: >-
      Custom fields can be added to usage or rental products or to rental
      product inventory lines
  - name: rental-product-category
    description: Rental product categories are used to group rental products together
paths:
  /usage-products:
    get:
      tags:
        - usage-products
      summary: Get a list of available usage products
      operationId: getUsageProducts
      x-si-permissions:
        - VIEW_USAGE_PRODUCT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: name
          in: query
          description: Filter by product name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: usageProductCategoryId
          in: query
          description: Filter by usage product category
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: availableFrom
          in: query
          description: Filter by available from date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: availableTo
          in: query
          description: Filter by available to date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: nominalCode
          in: query
          description: Filter by nominal code
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UsageProduct'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    post:
      tags:
        - usage-products
      summary: Create a new usage product
      operationId: createUsageProduct
      x-si-permissions:
        - CREATE_USAGE_PRODUCT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New usage product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UsageProduct'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProduct'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProduct'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    head:
      tags:
        - usage-products
      summary: Check if usage product exists
      operationId: checkUsageProduct
      x-si-permissions:
        - VIEW_USAGE_PRODUCT
      security:
        - bearerAuth: []
      parameters:
        - name: name
          in: query
          description: Filter by product name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: usageProductCategoryId
          in: query
          description: Filter by usage product category
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: availableFrom
          in: query
          description: Filter by available from date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: availableTo
          in: query
          description: Filter by available to date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: nominalCode
          in: query
          description: Filter by nominal code
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-products:
    get:
      tags:
        - rental-products
      summary: Get a list of available rental products
      operationId: getRentalProducts
      x-si-permissions:
        - VIEW_RENTAL_PRODUCT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: productType
          in: query
          description: Filter by product type
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: name
          in: query
          description: Filter by product name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: availableFrom
          in: query
          description: Filter by available from date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: availableTo
          in: query
          description: Filter by available to date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: nominalCode
          in: query
          description: Filter by nominal code
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: supplierId
          in: query
          description: Filter by supplier identifier
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RentalProduct'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    post:
      tags:
        - rental-products
      summary: Create a new rental product
      operationId: createRentalProduct
      x-si-permissions:
        - CREATE_RENTAL_PRODUCT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      requestBody:
        description: New rental product
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalProduct'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProduct'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProduct'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    head:
      tags:
        - rental-products
      summary: Check if rental product exists
      operationId: checkRentalProduct
      x-si-permissions:
        - VIEW_RENTAL_PRODUCT
      security:
        - bearerAuth: []
      parameters:
        - name: productType
          in: query
          description: Filter by product type
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: name
          in: query
          description: Filter by product name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: availableFrom
          in: query
          description: Filter by available from date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: availableTo
          in: query
          description: Filter by available to date
          schema:
            $ref: '#/components/schemas/DateFilterParam'
          required: false
        - name: nominalCode
          in: query
          description: Filter by nominal code
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: supplierId
          in: query
          description: Filter by supplier identifier
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
      responses:
        '200':
          description: Exists
          content: {}
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-products/{usage_product_id}:
    get:
      tags:
        - usage-products
      summary: Get a specific usage product
      operationId: getUsageProduct
      x-si-permissions:
        - VIEW_USAGE_PRODUCT
      security:
        - bearerAuth: []
      parameters:
        - name: usage_product_id
          in: path
          description: Usage product identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Usage product found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProduct'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    patch:
      tags:
        - usage-products
      summary: Update a usage product
      operationId: updateUsageProduct
      x-si-json-patch: true
      x-si-allow-patch:
        - /name
        - /nominalCode
        - /usageProductCategoryId
        - /direction
        - /performLocalAndNationalCheck
        - /available(From|To)
        - /productReferenceCanBeRange
        - /serviceIdRequired
        - /customFields.*
        - /customFields/.*/value
        - /productReferenceFormat
        - /serviceIdFormat
      x-si-permissions:
        - UPDATE_USAGE_PRODUCT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: usage_product_id
          in: path
          description: Usage product identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      requestBody:
        description: A set of JSONPatch operations to be performed
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchRequest'
            examples:
              Rename:
                value:
                  - op: replace
                    path: /name
                    value: My Product
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageProduct'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /rental-products/{rental_product_id}:
    get:
      tags:
        - rental-products
      summary: Get a specific rental product
      operationId: getRentalProduct
      x-si-permissions:
        - VIEW_RENTAL_PRODUCT
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_id
          in: path
          description: Rental product identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Rental product found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProduct'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    patch:
      tags:
        - rental-products
      summary: Update a rental product
      operationId: updateRentalProduct
      x-si-json-patch: true
      x-si-allow-patch:
        - /name
        - /invoicePresentationName
        - /supplierId
        - /supplierProductNames.*
        - /taxBandId
        - /available(From|To)
        - /nominalCode
        - /doNotProRate
        - /additionalProductReferenceRequired
        - /additionalProductReferenceFormat
        - /linkedUsageProductId
        - /productReferenceRequired
        - /productReferenceFormat
        - /productReferenceMayBeDDIRange
        - /customFields.*
        - /customFields/.*/value
        - /generateWhenParentCreated
        - /forceBillPeriods
        - /alignedToStart
        - /alignedToBillPeriod
        - /billInitialChargesImmediately
      x-si-permissions:
        - UPDATE_RENTAL_PRODUCT
      x-si-apply-impact-of-change: true
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_id
          in: path
          description: Rental product identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      requestBody:
        description: A set of JSONPatch operations to be performed
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/PatchRequest'
            examples:
              Rename:
                value:
                  - op: replace
                    path: /name
                    value: My RPI
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProduct'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-product-categories:
    get:
      tags:
        - usage-products
      summary: Get a list of available usage product categories
      operationId: getUsageProductCategories
      x-si-permissions:
        - VIEW_USAGE_PRODUCT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: name
          in: query
          description: Filter by name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UsageProductCategory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /rental-product-categories:
    get:
      tags:
        - rental-product-category
      summary: Get a list of available rental product categories
      operationId: getRentalProductCategories
      x-si-permissions:
        - VIEW_RENTAL_PRODUCT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: name
          in: query
          description: Filter by name
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RentalProductCategory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
    post:
      tags:
        - rental-product-category
      summary: Create a new rental category
      operationId: createRentalCategory
      x-si-permissions:
        - CREATE_RENTAL_PRODUCT_CATEGORY
      security:
        - bearerAuth: []
      requestBody:
        description: New rental product category
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RentalProductCategory'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductCategory'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductCategory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /rental-product-categories/{rental_product_category_id}:
    get:
      tags:
        - rental-product-category
      summary: Get a specific rental product category
      operationId: getRentalProductCategory
      x-si-permissions:
        - VIEW_RENTAL_PRODUCT_CATEGORY
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_category_id
          in: path
          description: Rental product category identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Rental product category found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductCategory'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    delete:
      tags:
        - rental-product-category
      summary: Delete a rental product category
      operationId: deleteRentalProductCategory
      x-si-permissions:
        - DELETE_RENTAL_PRODUCT_CATEGORY
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_category_id
          in: path
          description: Rental product category identifier
          required: true
          schema:
            $ref: '#/components/schemas/IdParam'
      responses:
        '200':
          description: Success
          content: {}
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
    patch:
      tags:
        - rental-product-category
      summary: Update a specific rental product category
      description: Update a specific rental product category
      operationId: updateRentalProductCategory
      x-si-json-patch: true
      x-si-allow-patch:
        - /name
        - /startDate
        - /endDate
        - /contractOwnerIds/.*
        - /supplierAccountIds/.*
        - /displayIcon
      x-si-permissions:
        - UPDATE_RENTAL_PRODUCT_CATEGORY
      security:
        - bearerAuth: []
      parameters:
        - name: rental_product_category_id
          in: path
          description: Rental product category 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:
              RenameCategory:
                value:
                  - op: replace
                    path: /name
                    value: insurance
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RentalProductCategory'
        '400':
          description: Invalid Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
  /usage-product-suppliers:
    get:
      tags:
        - usage-products
      summary: Returns a list of available suppliers
      description: >-
        Returns a list of available suppliers and corresponding data sources for
        usage products
      operationId: getUsageProductSuppliers
      x-si-permissions:
        - VIEW_USAGE_PRODUCT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: id
          in: query
          description: Filter by id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: usageProductId
          in: query
          description: Filter by usage product id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: supplierId
          in: query
          description: Filter by supplier id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: supplierAccountId
          in: query
          description: Filter by supplier account id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: primaryReferenceDataSourceId
          in: query
          description: Filter by primary reference data source id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: secondaryReferenceDataSourceId
          in: query
          description: Filter by secondary reference data source id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/UsageProductSupplier'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
  /product-custom-fields:
    get:
      tags:
        - custom-fields
      summary: Get a list of available custom fields
      description: >-
        Get a list of available custom fields for usage, rental products and
        rental product inventories
      operationId: getProductCustomFields
      x-si-permissions:
        - VIEW_USAGE_PRODUCT
        - VIEW_RENTAL_PRODUCT
      security:
        - bearerAuth: []
      x-si-filterable: true
      parameters:
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/pageSize'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/fields'
        - name: label
          in: query
          description: Filter by label
          schema:
            $ref: '#/components/schemas/StringFilterParam'
          required: false
        - name: productCategoryId
          in: query
          description: Filter by product category id
          schema:
            $ref: '#/components/schemas/IdFilterParam'
          required: false
        - name: entityLevel
          in: query
          description: Filter by this entity level only
          schema:
            $ref: '#/components/schemas/CustomFieldEntityLevel'
          required: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustomFieldDefinition'
        '400':
          description: Bad Request
          content: {}
        '401':
          description: Unauthorized
          content: {}
        '403':
          description: Forbidden
          content: {}
components:
  schemas:
    RentalProduct:
      required:
        - productType
        - name
        - rentalProductCategoryId
        - invoicePresentationName
        - supplierId
        - taxBandId
        - availableFrom
      type: object
      x-si-class-validation: "@After(first = \"availableTo\", second = \"availableFrom\")\n@RequiredWhen.List({ @RequiredWhen(fieldName = \"productType\", fieldValue = \"EVENT\", dependFieldName = \"parentRentalProductId\"), \n                     @RequiredWhen(fieldName = \"productType\", fieldValue = \"FEATURE\", dependFieldName = \"parentRentalProductId\"), \n                     @RequiredWhen(fieldName = \"additionalProductReferenceRequired\", fieldValue = \"true\", dependFieldName = \"additionalProductReferenceFormat\"), \n                     @RequiredWhen(fieldName = \"productReferenceRequired\", fieldValue = \"true\", dependFieldName = \"productReferenceFormat\") })\n@NotAllowedWhen.List({\n                      \t@NotAllowedWhen(fieldName = \"alignedToStart\", fieldValue = \"true\", dependFieldName = \"alignedToBillPeriod\"),\n                      \t@NotAllowedWhen(fieldName = \"alignedToStart\", fieldValue = \"true\", dependFieldName = \"doNotProRate\"),\n                      \t@NotAllowedWhen(fieldName = \"doNotProRate\", fieldValue = \"true\", dependFieldName = \"alignedToStart\"),\n                      \t@NotAllowedWhen(fieldName = \"doNotProRate\", fieldValue = \"true\", dependFieldName = \"alignedToBillPeriod\"),\n                      \t@NotAllowedWhen(fieldName = \"alignedToBillPeriod\", fieldValue = \"true\", dependFieldName = \"alignedToStart\"),\n                      \t@NotAllowedWhen(fieldName = \"alignedToBillPeriod\", fieldValue = \"true\", dependFieldName = \"doNotProRate\") })\n"
      properties:
        id:
          description: Rental product identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        rentalProductCategoryId:
          description: Rental product category identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        productType:
          $ref: '#/components/schemas/RentalProductType'
        name:
          type: string
          description: Product name
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        invoicePresentationName:
          type: string
          description: Invoice Presentation name
          minLength: 1
          maxLength: 255
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        parentRentalProductId:
          description: Parent rental product identifier
          type: integer
          format: int64
          example: 1
        supplierId:
          description: Supplier identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
        supplierProductNames:
          description: Mapping name(s) used by the supplier in their invoice file
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 100
            pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        taxBandId:
          description: Supplier account identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        availableFrom:
          description: Product is available from this date
          type: string
          format: date
        nominalCode:
          description: Nominal code
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[\w\p{L}\s%£@&#=':;,`’|!_—–()/\-+.?*$\[\]€^{}<>~]*$
          example: SALES-01QTR2
        availableTo:
          description: Product is available to this date
          type: string
          format: date
        doNotProRate:
          description: Do not pro rate
          type: boolean
          default: false
        alignedToStart:
          description: >-
            Default value for alignedToStart when creating rental product
            inventories
          type: boolean
          default: false
        alignedToBillPeriod:
          description: >-
            Default value for alignedToBillPeriod when creating rental product
            inventories
          type: boolean
          default: false
        billInitialChargesImmediately:
          description: >-
            Default value for billInitialChargesImmediately when creating rental
            product inventories
          type: boolean
          default: false
        forceBillPeriods:
          description: >-
            Default value for forceBillPeriods when creating rental product
            inventories. When this is 0, forceBilling on the rental product
            inventories will be set to false
          example: 1
          minimum: 0
          maximum: 731
          default: 0
          type: integer
          format: int32
        additionalProductReferenceRequired:
          description: >-
            Additional product reference is required on rental product
            inventories
          type: boolean
          default: false
        additionalProductReferenceFormat:
          description: >-
            Regular expression (regex) used to validate the additional product
            reference on rental product inventories
          type: string
          minLength: 0
          maxLength: 50
          example: '[a-zA-Z0-9]{4,15}'
        linkedUsageProductId:
          description: Linked usage product identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        productReferenceRequired:
          description: Product reference is required on rental product
          type: boolean
          default: false
        productReferenceFormat:
          description: >-
            Regular expression (regex) used to validate the product reference on
            rental product inventories
          type: string
          minLength: 0
          maxLength: 50
          example: .*
        productReferenceMayBeDDIRange:
          description: Product reference may be a DDI range on rental product
          type: boolean
          default: false
        generateWhenParentCreated:
          description: >-
            Generate a FEATURE or EVENT RPI for this product when the
            parentRentalProduct is assigned to a new RPI. Will skip generation
            for products whose availableTo is in the past
          type: boolean
          default: false
        customFields:
          type: array
          items:
            $ref: '#/components/schemas/CustomField'
    UsageProduct:
      required:
        - name
        - usageProductCategoryId
        - direction
        - availableFrom
        - productReferenceFormat
      type: object
      x-si-class-validation: |
        @After(first = "availableTo", second = "availableFrom")
      properties:
        id:
          description: Usage product identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        name:
          type: string
          description: Usage product name
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        nominalCode:
          description: Nominal code
          type: string
          minLength: 1
          maxLength: 100
          pattern: ^[\w\p{L}\s%£@&#=':;,`’|!_—–()/\-+.?*$\[\]€^{}<>~]*$
          example: SALES-01QTR2
        usageProductCategoryId:
          description: Usage product category identifier
          type: integer
          format: int64
          x-si-validation: '@ValidId'
          example: 1
        direction:
          $ref: '#/components/schemas/UsageProductDirection'
        performLocalAndNationalCheck:
          description: Perform local and national check
          type: boolean
          default: true
        availableFrom:
          description: Product is available from
          type: string
          format: date
        availableTo:
          description: Product is available to
          type: string
          format: date
        productReferenceCanBeRange:
          description: Product reference can be range
          type: boolean
          default: true
        serviceIdRequired:
          description: Service id is required on rental product inventories
          type: boolean
          default: false
        customFields:
          type: array
          items:
            $ref: '#/components/schemas/CustomField'
        productReferenceFormat:
          description: >-
            Regular expression used to validate product references on usage
            product inventories
          type: string
          minLength: 1
          example: '[0-9]{3,11}'
        serviceIdFormat:
          description: >-
            Regular expression used to validate service ids on usage product
            inventories
          type: string
          minLength: 1
          example: '[a-zA-Z0-9\-]{3,100}'
    UsageProductSupplier:
      required:
        - id
        - usageProductId
        - supplierId
        - supplierAccountId
        - primaryReferenceDataSourceId
        - secondaryReferenceDataSourceId
      type: object
      properties:
        id:
          description: usage product supplier identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        usageProductId:
          description: usage product identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        supplierId:
          description: supplier identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        supplierAccountId:
          description: supplier account identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        primaryReferenceDataSourceId:
          description: primary reference data source identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        secondaryReferenceDataSourceId:
          description: secondary reference data source identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
    UsageProductCategory:
      required:
        - name
      type: object
      properties:
        id:
          description: Usage product category identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        name:
          type: string
          description: Usage product category name
          minLength: 1
          maxLength: 50
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
    RentalProductCategory:
      required:
        - name
        - startDate
        - contractOwnerIds
      type: object
      x-si-class-validation: |
        @After(first = "endDate", second = "startDate")
      properties:
        id:
          description: Rental product category identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        name:
          type: string
          description: Rental product category name
          minLength: 1
          maxLength: 50
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
          x-si-validation: >
            @NotNull(message = "property needs to be provided")

            @Pattern(regexp =
            "[\\w\\p{L}\\s%£@&#=':;`’,|!_—–\\(\\)\\\\/\\-\\+\\.\\?\\*\\$]*", 
                     message = "can only contain letters, numbers, spaces or these special characters: %£@&#=':;`’,|!_-()/+.?*$")
        startDate:
          description: Rental product category start date
          type: string
          format: date
          x-si-validation: '@NotNull(message = "property needs to be provided")'
        endDate:
          description: Rental product category end date
          type: string
          format: date
        siMaintained:
          readOnly: true
          description: >-
            If true the product categories is maintained by SI. The products
            under this category cannot be created,updated or deleted
          type: boolean
          default: false
        contractOwnerIds:
          description: Contract owner identifiers
          type: array
          items:
            type: integer
            format: int32
            x-si-validation: '@ValidId'
            example: 1
          minItems: 1
          x-si-validation: >-
            @NotNull(message = "contractOwnerIds property needs to be provided")
            @Size(min = 1, message = "at least one contract owner needs to be
            provided")
        supplierAccountIds:
          description: Supplier account ids with this category
          type: array
          items:
            type: integer
            format: int32
            x-si-validation: '@ValidId'
            example: 1
        displayIcon:
          $ref: '#/components/schemas/DisplayIconType'
    CustomFieldDefinition:
      required:
        - label
        - productCategoryIds
        - entityLevel
      type: object
      properties:
        id:
          description: Custom field identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        label:
          type: string
          description: Label for the custom field
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        productCategoryIds:
          type: array
          description: Product categories that this custom field applies to
          items:
            type: integer
            format: int64
        entityLevel:
          $ref: '#/components/schemas/CustomFieldEntityLevel'
    UsageProductDirection:
      description: Usage product direction
      type: string
      enum:
        - INBOUND
        - OUTBOUND
    RentalProductType:
      description: Rental product type
      type: string
      enum:
        - PRODUCT
        - FEATURE
        - EVENT
    DisplayIconType:
      description: Display icon for the rental product category
      type: string
      enum:
        - fa-wifi
        - fa-sitemap
        - fa-server
        - fa-hdd-o
        - fa-database
        - fa-plug
        - fa-bolt
        - fa-cloud
        - fa-cloud-download
        - fa-cloud-upload
        - fa-globe
        - fa-exchange
        - fa-lock
        - fa-unlock
        - fa-shield
        - fa-cogs
        - fa-rss
        - fa-code-fork
        - fa-random
        - fa-location-arrow
        - fa-terminal
        - fa-phone
        - fa-envelope-o
        - fa-wrench
    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
    StringFilterParam:
      description: >-
        Filter by this string value where value can optionally be prefixed
        (in:|like:)
      example: xyz | in:x,y | like:xyz
      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
    CustomField:
      required:
        - label
        - value
      type: object
      properties:
        id:
          description: Custom field identifier
          type: integer
          readOnly: true
          format: int64
          example: 1
        label:
          type: string
          description: Custom field label
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
        value:
          type: string
          description: Custom field value
          minLength: 1
          maxLength: 100
          pattern: '[\w\p{L}\s%£@&#='':;`’,|!_—–\(\)\\/\-\+\.\?\*\$]*'
    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'
    CustomFieldEntityLevel:
      description: Indicates the entity level the custom field applies to
      type: string
      enum:
        - USAGE_PRODUCT
        - RENTAL_PRODUCT
        - RENTAL_PRODUCT_INVENTORY
        - SITE
        - CUSTOMER
  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
