openapi: 3.0.1
info:
  title: Roles
  version: 2.10.0
  description: Roles REST API for entities management.
  contact:
    name: Tradevest GmbH
servers:
  - url: https://tvda-api.platform-test.tradevest.ai
    description: Test
security:
  - Bearer: []
tags:
  - name: Customers
    description: Customers
  - name: Customer Labels
    description: Customer Labels
  - name: Proxies
    description: Proxies
  - name: Onboardings
    description: Onboardings
  - name: Offboardings
    description: Offboardings
paths:
  /roles/customers:
    post:
      summary: Create Customer
      operationId: create-customer
      description: Assign entity the role of customer.
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      tags:
        - Customers
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCustomerResult'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerData'
    get:
      summary: Get Customers
      operationId: get-customers
      description: Get a list of customers.
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      tags:
        - Customers
      parameters:
        - $ref: '#/components/parameters/cursor'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/entityId'
        - $ref: '#/components/parameters/customerStatus'
        - $ref: '#/components/parameters/customerEntityType'
        - $ref: '#/components/parameters/labels'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customers'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /roles/customers/{customerId}:
    parameters:
      - $ref: '#/components/parameters/customerId'
    get:
      summary: Get Customer
      operationId: get-customer
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      description: Get customer
      tags:
        - Customers
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Customer'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    patch:
      summary: Update Customer
      operationId: update-customer
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      description: Update customer
      tags:
        - Customers
      parameters:
        - $ref: '#/components/parameters/requestorId'
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerUpdate'
  /roles/customers/statistics/status-counts:
    get:
      summary: Get Customers Status Counts
      operationId: get-customers-status-counts
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      description: Returns the count of customers for each possible status
      tags:
        - Customers
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CustomerStatusCounts'
  /roles/customer-labels:
    get:
      summary: Get List of Customer Labels with assigned customers count
      operationId: get-all-customer-labels-with-customers-count
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/CustomerLabelWithAssignedCustomersCount'
                description: list of labels (items to allow grouping of customers as per required logic) with assigned customers count
      description: Get list of customer labels created by partner with assigned customers count
      tags:
        - Customer Labels
  /roles/customer-labels/{labelName}:
    parameters:
      - $ref: '#/components/parameters/labelName'
    patch:
      summary: Update Customer Label
      operationId: update-customer-label
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      responses:
        '202':
          description: Accepted
          content: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CustomerLabelUpdate'
      description: Update customer label by changing name. All assigned customers will have updated label name.
      tags:
        - Customer Labels
    delete:
      summary: Remove Label And Its Assignment From All Customers
      operationId: remove-label-and-its-assignment-from-all-customers
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      responses:
        '202':
          description: Accepted
      description: Removes label from all assigned customers.
      tags:
        - Customer Labels
  /roles/customer-labels/{labelName}/customers:
    parameters:
      - $ref: '#/components/parameters/labelName'
    patch:
      summary: Add Label To All Provided Customers
      operationId: add-label-to-all-provided-customers
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      responses:
        '202':
          description: Accepted
          content: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                format: uuid
      description: Update assignment of customer label to all provided customers. If any customer exceeds the maximum number of labels (16), the request will fail and return in response customer ids that exceeded maximum number of labels. If any customer id is not valid, the request will fail and return in response invalid customer ids.
      tags:
        - Customer Labels
    post:
      summary: Remove Label From All Provided Customers
      operationId: remove-label-from-all-provided-customers
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      responses:
        '202':
          description: Accepted
          content: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
                format: uuid
      description: Remove assignment of customer label from all provided customers. If any customer id is not valid, the request will fail and return in response invalid customer ids.
      tags:
        - Customer Labels
  /roles/proxies:
    post:
      summary: Create Proxy
      operationId: create-proxy
      description: Assign natural persons the role of authorized proxy.
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      tags:
        - Proxies
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateProxyResult'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProxyCreateData'
    get:
      summary: Get Proxies
      operationId: get-proxies
      description: Get a list of proxies.
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      tags:
        - Proxies
      parameters:
        - $ref: '#/components/parameters/cursor'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/naturalPersonId'
        - $ref: '#/components/parameters/entityId'
        - $ref: '#/components/parameters/proxyStatus'
        - $ref: '#/components/parameters/proxyType'
        - $ref: '#/components/parameters/proxyValidityType'
        - $ref: '#/components/parameters/customerProductIds'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Proxies'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
  /roles/proxies/{proxyId}:
    parameters:
      - $ref: '#/components/parameters/proxyId'
    get:
      summary: Get Proxy
      operationId: get-proxy
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      description: Get proxy
      tags:
        - Proxies
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Proxy'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    patch:
      summary: Update Proxy
      operationId: update-proxy
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      description: Update proxy
      tags:
        - Proxies
      parameters:
        - $ref: '#/components/parameters/requestorId'
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProxyUpdate'
  /roles/onboardings:
    post:
      summary: Start Onboarding
      operationId: start-onboarding
      description: Start onboarding process for a role
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      tags:
        - Onboardings
      parameters:
        - $ref: '#/components/parameters/requestorId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartOnboardingResult'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleOnboardingData'
    get:
      summary: Get Onboardings
      operationId: get-onboardings
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleOnboarding'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Get list of onboardings for a role
      tags:
        - Onboardings
      parameters:
        - $ref: '#/components/parameters/onboardingRoleType'
        - $ref: '#/components/parameters/roleId'
  /roles/onboardings/{onboardingId}:
    parameters:
      - $ref: '#/components/parameters/onboardingId'
    get:
      summary: Get Onboarding
      operationId: get-onboarding
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleOnboarding'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      description: Get onboarding information
      tags:
        - Onboardings
  /roles/offboardings:
    post:
      summary: Start Offboarding
      operationId: start-offboarding
      description: Start offboarding process process for a role
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      tags:
        - Offboardings
      parameters:
        - $ref: '#/components/parameters/requestorId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartOffboardingResult'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RoleOffboardingData'
    get:
      summary: Get Offboardings
      operationId: get-offboardings
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      description: Get list of offboardings for a role
      tags:
        - Offboardings
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleOffboarding'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
      parameters:
        - $ref: '#/components/parameters/offboardingRoleType'
        - $ref: '#/components/parameters/roleId'
  /roles/offboardings/{offboardingId}:
    parameters:
      - $ref: '#/components/parameters/offboardingId'
    get:
      summary: Get Offboarding
      operationId: get-offboarding
      x-operation-group: roles-query
      x-required-permissions: rs/roles/read
      description: Get offboarding information
      tags:
        - Offboardings
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoleOffboarding'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
    delete:
      summary: Cancel Offboarding
      operationId: cancel-offboarding
      x-operation-group: roles-command
      x-required-permissions: rs/roles/write
      description: Cancel created offboarding if not started.
      tags:
        - Offboardings
      parameters:
        - $ref: '#/components/parameters/requestorId'
      responses:
        '202':
          description: Accepted
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    CustomerData:
      title: CustomerData
      type: object
      required:
        - entityId
        - entityType
      properties:
        entityId:
          type: string
          format: uuid
          description: Identifier of the entity, natural person, joint person or legal entity, who will become a customer.
        entityType:
          $ref: '#/components/schemas/CustomerEntityTypeEnum'
        refAccounts:
          type: array
          items:
            $ref: '#/components/schemas/RefAccountData'
        labels:
          type: array
          maxLength: 16
          items:
            type: string
            minLength: 1
          description: Up to 16 user-defined labels can be provided to allow grouping of customers as per required logic
    Customer:
      type: object
      required:
        - createdOn
        - customerId
        - customerStatus
        - entityId
        - entityType
        - modifiedOn
      properties:
        customerId:
          type: string
          format: uuid
        customerStatus:
          $ref: '#/components/schemas/CustomerStatusEnum'
        signedDocumentsRelatedToCustomer:
          type: array
          items:
            $ref: '#/components/schemas/DocumentSignatureRelatedToCustomer'
        createdOn:
          type: string
          format: date-time
          description: The date on which the customer was created
        modifiedOn:
          type: string
          format: date-time
          description: The date on which the customer was updated
        cancellationDate:
          type: string
          format: date-time
          description: The date on which the customer was cancelled (date of offboarding)
        reassessment:
          $ref: '#/components/schemas/Reassessment'
        entityId:
          type: string
          format: uuid
          description: Identifier of the entity, natural person, joint person or legal entity, who will become a customer.
        entityType:
          $ref: '#/components/schemas/CustomerEntityTypeEnum'
        refAccounts:
          type: array
          items:
            $ref: '#/components/schemas/RefAccountData'
        labels:
          type: array
          maxLength: 16
          items:
            type: string
            minLength: 1
          description: Up to 16 user-defined labels can be provided to allow grouping of customers as per required logic
      title: Customer
    Customers:
      title: Customers
      type: object
      properties:
        data:
          type: array
          description: Array of customers
          items:
            $ref: '#/components/schemas/Customer'
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - data
        - pagination
    CustomerUpdate:
      title: CustomerUpdate
      type: object
      properties:
        labels:
          type: array
          maxLength: 16
          description: Up to 16 user-defined labels can be provided to allow grouping of customers as per required logic
          items:
            type: string
            minLength: 1
        refAccounts:
          type: array
          items:
            $ref: '#/components/schemas/RefAccountData'
    CreateCustomerResult:
      title: CreateCustomerResult
      type: object
      properties:
        customerId:
          type: string
          format: uuid
          readOnly: true
      required:
        - customerId
    ProxyData:
      title: ProxyData
      type: object
      required:
        - naturalPersonId
        - entityId
        - entityType
        - validityType
      properties:
        naturalPersonId:
          type: string
          format: uuid
          description: Identifier of the natural person, who will be assigned as proxy.
        entityId:
          type: string
          format: uuid
          description: Identifier of the entity, natural person, joint person or legal entity, who will be managed by the proxy.
        entityType:
          $ref: '#/components/schemas/ProxyEntityTypeEnum'
        productIds:
          type: array
          description: IDs of the customers products for which the proxy is allowed to take actions in behalf of the entity which is customer (multiple products possible).
          items:
            type: string
            format: uuid
        validityType:
          $ref: '#/components/schemas/ProxyValidityTypeEnum'
        scopeType:
          $ref: '#/components/schemas/ProxyScopeTypeEnum'
        custodyType:
          $ref: '#/components/schemas/ProxyCustodyTypeEnum'
    ProxyCreateData:
      type: object
      required:
        - entityId
        - entityType
        - naturalPersonId
        - proxyType
        - validityType
      properties:
        proxyType:
          $ref: '#/components/schemas/ProxyTypeAssignableEnum'
        naturalPersonId:
          type: string
          format: uuid
          description: Identifier of the natural person, who will be assigned as proxy.
        entityId:
          type: string
          format: uuid
          description: Identifier of the entity, natural person, joint person or legal entity, who will be managed by the proxy.
        entityType:
          $ref: '#/components/schemas/ProxyEntityTypeEnum'
        productIds:
          type: array
          description: IDs of the customers products for which the proxy is allowed to take actions in behalf of the entity which is customer (multiple products possible).
          items:
            type: string
            format: uuid
        validityType:
          $ref: '#/components/schemas/ProxyValidityTypeEnum'
        scopeType:
          $ref: '#/components/schemas/ProxyScopeTypeEnum'
        custodyType:
          $ref: '#/components/schemas/ProxyCustodyTypeEnum'
      title: ProxyCreateData
    Proxy:
      type: object
      required:
        - createdOn
        - entityId
        - entityType
        - modifiedOn
        - naturalPersonId
        - proxyId
        - proxyStatus
        - proxyType
        - validityType
      properties:
        proxyId:
          type: string
          format: uuid
        proxyStatus:
          $ref: '#/components/schemas/ProxyStatusEnum'
        createdOn:
          type: string
          format: date-time
          description: The date on which the proxy was created
        modifiedOn:
          type: string
          format: date-time
          description: The date on which the proxy was updated
        proxyType:
          $ref: '#/components/schemas/ProxyTypeEnum'
        naturalPersonId:
          type: string
          format: uuid
          description: Identifier of the natural person, who will be assigned as proxy.
        entityId:
          type: string
          format: uuid
          description: Identifier of the entity, natural person, joint person or legal entity, who will be managed by the proxy.
        entityType:
          $ref: '#/components/schemas/ProxyEntityTypeEnum'
        productIds:
          type: array
          description: IDs of the customers products for which the proxy is allowed to take actions in behalf of the entity which is customer (multiple products possible).
          items:
            type: string
            format: uuid
        validityType:
          $ref: '#/components/schemas/ProxyValidityTypeEnum'
        scopeType:
          $ref: '#/components/schemas/ProxyScopeTypeEnum'
        custodyType:
          $ref: '#/components/schemas/ProxyCustodyTypeEnum'
      title: Proxy
    Proxies:
      title: Proxies
      type: object
      properties:
        data:
          type: array
          description: Array of proxies
          items:
            $ref: '#/components/schemas/Proxy'
        pagination:
          $ref: '#/components/schemas/Pagination'
      required:
        - data
        - pagination
    CreateProxyResult:
      title: CreateProxyResult
      type: object
      properties:
        proxyId:
          type: string
          format: uuid
          readOnly: true
      required:
        - proxyId
    ProxyUpdate:
      title: ProxyUpdate
      type: object
      properties:
        proxyUpdateData:
          $ref: '#/components/schemas/ProxyUpdateData'
        documentId:
          type: string
          format: uuid
          description: Document ID in UUID format for those params where a document upload is required (scopeType, custodyType)
      required:
        - proxyUpdateData
    ProxyUpdateData:
      title: ProxyUpdateData
      type: object
      properties:
        customerProductIds:
          type: array
          description: |
            Update only possible for proxyType `POWER_OF_ATTORNEY` and `INFORMATION_PROXY`.\
            IDs of the customers products for which the proxy is allowed to take actions in behalf of the customer (multiple products possible).
          items:
            type: string
            format: uuid
        validityType:
          $ref: '#/components/schemas/ProxyUpdateValidityTypeEnum'
        proxyType:
          $ref: '#/components/schemas/ProxyUpdateTypeEnum'
        scopeType:
          title: ProxyScopeTypeEnum
          type: string
          enum:
            - INDIVIDUAL
            - JOINT
          description: |
            Update only possible for for proxyType `SIGNATORY`
            Defines the scope of the power of representation, which is dependent on the underlying signature authorisation of the legal representative:
            - INDIVIDUAL: If soleSignatureAuthorized of the legal representative = YES
            - JOINT: If soleSignatureAuthorized of the legal representative = NO
            A corresponding document (registry extract) must be submitted to update the scope type. When uploading the document via respecting endpoint, the exact document name must be specified under ‘name’ and ‘CURRENT_REGISTRY_EXTRACT’ must be selected as the type.
        custodyType:
          title: ProxyCustodyTypeEnum
          type: string
          enum:
            - SINGLE_CUSTODY
            - JOINT_CUSTODY
          description: |
            Update only possible for proxyType `GUARDIAN`.
            Specifies the type of custody associated with the guardian.
            - `SINGLE_CUSTODY`: Indicates that only one guardian holds legal and physical custody of the child.
            - `JOINT_CUSTODY`: Indicates that the custody of the child is shared between two guardians, typically implying both have legal rights concerning the child's upbringing.
            A corresponding document (proof of single custody) must be submitted to update the custody type. When uploading the document via respecting endpoint, the exact document name must be specified under ‘name’ and ‘PROOF_OF_SINGLE_CUSTODY’ must be selected as the type.
    RefAccountData:
      title: RefAccountData
      type: object
      properties:
        bankName:
          type: string
          description: Name of the bank
          minLength: 1
          maxLength: 255
          pattern: ^.*\S+.*$
        iban:
          type: string
          description: IBAN
          pattern: ^[A-Z]{2}[0-9A-Z]{14,31}$
          maxLength: 33
        bic:
          type: string
          description: BIC (Business Identifier Code) or SWIFT (Society for Worldwide Interbank Financial Telecommunication) code used to identify a bank internationally
          minLength: 8
          maxLength: 11
          pattern: ^[A-Z]{6}[A-Z\d]{2}(?:[A-Z\d]{3})?$
        type:
          $ref: '#/components/schemas/RefAccountTypeEnum'
        ownerName:
          type: string
          description: full name of the ref account owner or full name of the company owning the ref account
          minLength: 1
          maxLength: 255
          pattern: ^.*\S+.*$
      required:
        - iban
        - ownerName
    DocumentSignatureRelatedToCustomer:
      title: DocumentSignatureRelatedToCustomer
      type: object
      properties:
        partnerDocumentId:
          type: string
          format: uuid
          description: Id of the partner document which was signed
        name:
          type: string
          minLength: 1
          description: Name of the document
        documentType:
          $ref: '#/components/schemas/DocumentSignatureTypeEnum'
        version:
          type: integer
          description: Version of the document
        naturalPersonId:
          type: string
          format: uuid
          description: Id of the natural person, which signed the TERMS_AND_CONDITIONS document for the customer
        naturalPersonFullName:
          type: string
          minLength: 1
          description: Full name of the natural person, which signed the TERMS_AND_CONDITIONS document for the customer
        createdOn:
          type: string
          format: date-time
          description: The date on which the document signature was created
          readOnly: true
        modifiedOn:
          type: string
          format: date-time
          description: The date on which the document signature was modified the last time
          readOnly: true
      required:
        - partnerDocumentId
        - name
        - documentType
        - version
        - naturalPersonId
        - naturalPersonFullName
        - createdOn
        - modifiedOn
    CustomerLabelWithAssignedCustomersCount:
      title: CustomerLabelWithAssignedCustomersCount
      type: object
      properties:
        label:
          type: string
          minLength: 1
          description: name of customer label
        customersCount:
          type: integer
          description: number of customers assigned to label
      required:
        - label
        - customersCount
    CustomerLabelUpdate:
      title: CustomerLabelUpdate
      type: object
      properties:
        name:
          type: string
          minLength: 1
          description: name of customer label
      required:
        - name
    StartOnboardingResult:
      title: StartOnboardingResult
      type: object
      properties:
        onboardingId:
          type: string
          format: uuid
          readOnly: true
      required:
        - onboardingId
    RoleOnboardingData:
      title: RoleOnboardingData
      type: object
      properties:
        roleType:
          $ref: '#/components/schemas/OnboardingRoleTypeEnum'
        roleId:
          type: string
          format: uuid
          description: Identification number in UUID format of the role (customer or proxy)
      required:
        - roleType
        - roleId
    RoleOnboarding:
      type: object
      properties:
        onboardingId:
          type: string
          format: uuid
          readOnly: true
        status:
          $ref: '#/components/schemas/OnboardingStatusEnum'
        roleType:
          $ref: '#/components/schemas/OnboardingRoleTypeEnum'
        roleId:
          type: string
          format: uuid
          description: Identification number in UUID format of the role (customer or proxy)
        createdOn:
          type: string
          format: date-time
          readOnly: true
        modifiedOn:
          type: string
          format: date-time
          readOnly: true
      required:
        - createdOn
        - modifiedOn
        - onboardingId
        - roleId
        - roleType
        - status
      title: RoleOnboarding
    StartOffboardingResult:
      title: StartOffboardingResult
      type: object
      properties:
        offboardingId:
          type: string
          format: uuid
          readOnly: true
      required:
        - offboardingId
    RoleOffboardingData:
      title: RoleOnboardingData
      type: object
      properties:
        roleType:
          $ref: '#/components/schemas/OffboardingRoleTypeEnum'
        roleId:
          type: string
          format: uuid
          description: Identification number in UUID format of the role (customer or proxy)
        reason:
          $ref: '#/components/schemas/OffboardingReasonEnum'
      required:
        - roleType
        - roleId
        - reason
    RoleOffboarding:
      type: object
      properties:
        offboardingId:
          type: string
          format: uuid
          readOnly: true
        status:
          $ref: '#/components/schemas/OffboardingStatusEnum'
        roleType:
          $ref: '#/components/schemas/OffboardingRoleTypeEnum'
        roleId:
          type: string
          format: uuid
          description: Identification number in UUID format of the role (customer or proxy)
        reason:
          $ref: '#/components/schemas/OffboardingReasonEnum'
        createdOn:
          type: string
          format: date-time
          readOnly: true
        modifiedOn:
          type: string
          format: date-time
          readOnly: true
      required:
        - createdOn
        - modifiedOn
        - offboardingId
        - reason
        - roleId
        - roleType
        - status
      title: RoleOffboarding
    Reassessment:
      title: Reassessment
      type: object
      properties:
        reassessmentDate:
          type: string
          format: date
        reassessmentType:
          $ref: '#/components/schemas/ReassessmentTypeEnum'
        reassessmentStatus:
          $ref: '#/components/schemas/ReassessmentStatusEnum'
      required:
        - reassessmentDate
        - reassessmentType
        - reassessmentStatus
    CustomerStatusCounts:
      title: CustomerStatusCounts
      type: array
      items:
        $ref: '#/components/schemas/CustomerStatusCount'
      example:
        - status: ACTIVE
          count: 150
        - status: PENDING
          count: 25
        - status: SUSPENDED
          count: 10
        - status: ARCHIVED
          count: 5
        - status: INACTIVE
          count: 3
        - status: REJECTED
          count: 2
        - status: REVIEW
          count: 8
        - status: RECEIVED
          count: 12
        - status: INVALID
          count: 1
        - status: SUSPENDED_COMPLIANCE
          count: 4
        - status: ESTATE
          count: 0
        - status: OFFBOARDING
          count: 0
        - status: CREATED
          count: 15
    CustomerStatusCount:
      title: CustomerStatusCount
      type: object
      properties:
        status:
          $ref: '#/components/schemas/CustomerStatusEnum'
        count:
          type: integer
          description: Number of customers with this status
      required:
        - status
        - count
    CustomerStatusEnum:
      title: CustomerStatusEnum
      type: string
      description: Current customer status
      enum:
        - CREATED
        - REVIEW
        - REJECTED
        - INACTIVE
        - ACTIVE
        - SUSPENDED
        - ARCHIVED
        - RECEIVED
        - INVALID
        - PENDING
        - SUSPENDED_COMPLIANCE
        - ESTATE
        - OFFBOARDING
    CustomerEntityTypeEnum:
      title: CustomerEntityTypeEnum
      type: string
      enum:
        - NATURAL_PERSON
        - LEGAL_ENTITY
        - JOINT_PERSON
    DocumentSignatureTypeEnum:
      title: DocumentSignatureTypeEnum
      type: string
      enum:
        - TERMS_AND_CONDITIONS
        - DATA_PRIVACY_POLICY
    ReassessmentTypeEnum:
      title: ReassessmentTypeEnum
      type: string
      enum:
        - PERIODIC
        - EVENT_DRIVEN
    ReassessmentStatusEnum:
      title: ReassessmentStatusEnum
      type: string
      enum:
        - SCHEDULED
        - PENDING
        - OVERDUE
        - COMPLETED
    RefAccountTypeEnum:
      title: RefAccountTypeEnum
      type: string
      enum:
        - PRIMARY
        - OTHER
      description: Reference account type enum
    Pagination:
      title: Pagination
      type: object
      properties:
        cursor:
          type: string
          description: String value used for pagination, which should be set in next page request.
        limit:
          type: integer
          description: Maximum number of returned items
      required:
        - cursor
        - limit
    ErrorDetailsExplanation:
      title: ErrorDetailsExplanation
      type: object
      properties:
        code:
          type: string
          maxLength: 255
        parameter:
          type: string
        message:
          type: string
      required:
        - code
        - message
    ErrorDetails:
      title: ErrorDetails
      type: object
      properties:
        field:
          type: string
          maxLength: 255
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetailsExplanation'
      required:
        - field
    ErrorMessage:
      title: ErrorMessage
      type: object
      properties:
        message:
          type: string
        responseType:
          type: string
        validationString:
          minLength: 1
          type: string
        requestId:
          type: string
        errorCode:
          type: string
          maxLength: 255
        errorDetails:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetails'
      required:
        - message
        - responseType
        - requestId
    ProxyStatusEnum:
      title: ProxyStatusEnum
      type: string
      enum:
        - CREATED
        - REVIEW
        - REJECTED
        - ACTIVE
        - INACTIVE
        - RECEIVED
        - INVALID
        - PENDING
        - SUSPENDED
        - SUSPENDED_COMPLIANCE
    ProxyTypeEnum:
      title: ProxyTypeEnum
      type: string
      enum:
        - GENERAL_POWER_OF_ATTORNEY
        - INFORMATION_PROXY
        - LIQUIDATOR
        - GUARDIAN
        - SIGNATORY
        - JOINT_ACCOUNT_HOLDER
    ProxyValidityTypeEnum:
      title: ProxyValidityTypeEnum
      type: string
      description: Defines the period of validity of the power of proxy.
      enum:
        - UNTIL_CASE_OF_DEATH
        - IN_CASE_OF_DEATH
        - UNTIL_LEGAL_AGE
        - UNLIMITED
    ProxyEntityTypeEnum:
      title: ProxyEntityTypeEnum
      type: string
      description: Defines the type of entity for which the proxy is assigned.The proxy can be assigned to a natural person, legal entity, or joint person.
      enum:
        - NATURAL_PERSON
        - LEGAL_ENTITY
        - JOINT_PERSON
    ProxyScopeTypeEnum:
      title: ProxyScopeTypeEnum
      type: string
      enum:
        - INDIVIDUAL
        - JOINT
      description: |
        Only mandatory for proxyType `SIGNATORY`\
        Defines the scope of the power of representation, which is dependent on the underlying signature authorisation of the legal representative:
        - INDIVIDUAL: If soleSignatureAuthorized of the legal representative = YES
        - JOINT: If soleSignatureAuthorized of the legal representative = NO
    ProxyCustodyTypeEnum:
      title: ProxyCustodyTypeEnum
      type: string
      enum:
        - SINGLE_CUSTODY
        - JOINT_CUSTODY
      description: |
        Only mandatory for proxyType `GUARDIAN`.
        Specifies the type of custody associated with the guardian. 
        - `SINGLE_CUSTODY`: Indicates that only one guardian holds legal and physical custody of the child.
        - `JOINT_CUSTODY`: Indicates that the custody of the child is shared between two guardians, typically implying both have legal rights concerning the child's upbringing.
    ProxyTypeAssignableEnum:
      title: ProxyTypeAssignableEnum
      type: string
      enum:
        - GENERAL_POWER_OF_ATTORNEY
        - INFORMATION_PROXY
        - LIQUIDATOR
        - GUARDIAN
        - SIGNATORY
    ProxyUpdateValidityTypeEnum:
      title: ProxyUpdateValidityTypeEnum
      type: string
      description: Update only possible for proxyType `POWER_OF_ATTORNEY` and `INFORMATION_PROXY`. Defines the period of validity of the power of proxy.
      enum:
        - UNTIL_CASE_OF_DEATH
        - UNLIMITED
    ProxyUpdateTypeEnum:
      title: ProxyUpdateTypeEnum
      type: string
      enum:
        - GENERAL_POWER_OF_ATTORNEY
        - INFORMATION_PROXY
        - LIQUIDATOR
        - GUARDIAN
        - SIGNATORY
    OnboardingRoleTypeEnum:
      title: OnboardingRoleTypeEnum
      type: string
      enum:
        - CUSTOMER
        - PROXY
    OnboardingStatusEnum:
      title: OnboardingStatusEnum
      type: string
      enum:
        - CREATED
        - PENDING
        - APPROVED
        - REJECTED
        - RECEIVED
        - INVALID
      readOnly: true
    OffboardingRoleTypeEnum:
      title: OffboardingRoleTypeEnum
      type: string
      enum:
        - CUSTOMER
        - PROXY
    OffboardingStatusEnum:
      title: OffboardingStatusEnum
      type: string
      enum:
        - RECEIVED
        - CREATED
        - PENDING
        - INVALID
        - REJECTED
        - CANCELED
        - APPROVED
      readOnly: true
    OffboardingReasonEnum:
      title: OffboardingReasonEnum
      type: string
      enum:
        - CUSTOMER_REQUEST_IMMEDIATE
        - CANCELLATION_BY_PARTNER_ORDINARY
        - CANCELLATION_BY_PARTNER_IMMEDIATE
        - DEATH_IMMEDIATE
        - DISSOLUTION_IMMEDIATE
        - INSOLVENCY_IMMEDIATE
        - COMPANY_STRUCTURE_CHANGES_IMMEDIATE
        - REVOKE
  parameters:
    cursor:
      schema:
        type: string
      in: query
      name: cursor
      description: String value used for pagination
    limit:
      schema:
        type: integer
        default: 20
        minimum: 1
      in: query
      name: limit
      description: Maximum number of items to return
      required: true
    naturalPersonId:
      schema:
        type: string
        format: uuid
      name: naturalPersonId
      in: query
      description: Natural Person ID
    entityId:
      schema:
        type: string
        format: uuid
      name: entityId
      in: query
      description: Entity ID
    customerStatus:
      schema:
        $ref: '#/components/schemas/CustomerStatusEnum'
      in: query
      name: customerStatus
      description: Customer status
    customerEntityType:
      schema:
        $ref: '#/components/schemas/CustomerEntityTypeEnum'
      in: query
      name: customerType
      description: Customer type
    proxyStatus:
      schema:
        $ref: '#/components/schemas/ProxyStatusEnum'
      in: query
      name: proxyStatus
      description: Proxy status
    proxyType:
      schema:
        $ref: '#/components/schemas/ProxyTypeEnum'
      in: query
      name: proxyType
      description: Proxy type
    proxyValidityType:
      schema:
        $ref: '#/components/schemas/ProxyValidityTypeEnum'
      in: query
      name: proxyValidityType
      description: Proxy validity type
    customerProductIds:
      schema:
        type: array
        items:
          type: string
          format: uuid
      in: query
      name: customerProductIds
      description: IDs of the customers products for which the proxy is allowed to take actions in behalf of the customer (multiple products possible).
    labels:
      schema:
        type: array
        maxLength: 16
        items:
          type: string
      in: query
      name: labels
      description: user-defined labels (elements allow grouping of customers as per required logic) filter; will filter customers that have all of the provided labels
    customerId:
      schema:
        type: string
        format: uuid
      name: customerId
      in: path
      required: true
      description: Customer ID
    proxyId:
      schema:
        type: string
        format: uuid
      name: proxyId
      in: path
      required: true
      description: Proxy ID
    labelName:
      schema:
        type: string
      name: labelName
      in: path
      required: true
      description: Label Name
    requestorId:
      schema:
        type: string
        format: uuid
      name: Requestor-ID
      in: header
      required: true
      description: Unique requestor identification in UUID format
      x-requestor-id: true
    onboardingRoleType:
      schema:
        $ref: '#/components/schemas/OnboardingRoleTypeEnum'
      name: onboardingRoleType
      in: query
      required: true
      description: Type of role for onboarding
    roleId:
      schema:
        type: string
        format: uuid
      name: roleId
      in: query
      required: true
      description: Unique identification number of role (customer or proxy) in UUID format.
    onboardingId:
      schema:
        type: string
        format: uuid
      name: onboardingId
      in: path
      required: true
      description: Unique onboarding identification number in UUID format
    offboardingId:
      schema:
        type: string
        format: uuid
      name: offboardingId
      in: path
      required: true
      description: Unique offboarding identification number in UUID format
    offboardingRoleType:
      schema:
        $ref: '#/components/schemas/OffboardingRoleTypeEnum'
      name: offboardingRoleType
      in: query
      required: true
      description: Type of role for offboarding
  securitySchemes:
    Bearer:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://tvdcustomauthdomain.auth.eu-central-1.amazoncognito.com/oauth2/token
          scopes: {}
x-tagGroups:
  - name: Customers
    tags:
      - Customers
      - Customer Labels
  - name: Proxies
    tags:
      - Proxies
  - name: Onboardings
    tags:
      - Onboardings
  - name: Offboardings
    tags:
      - Offboardings
