openapi: 3.0.1
servers:
  - url: https://api.contactlab.it/account/v1
  - url: https://api.clab-dev.com/account/v1
info:
  version: 1.5.0
  title: Accountcentral API
tags:
  - name: service
    description: The endpoints of the "service" category are designed to support other APIs
paths:
  /service/me:
    get:
      summary: Get user basic information for API use
      description: |
        Search and retrive basic user information
      tags:
        - service
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  userPk:
                    type: integer
                  name:
                    type: string
                  surname:
                    type: string
                  username:
                    type: string
                  email:
                    type: string
                  picture:
                    type: string
                  lang:
                    type: string
                  timezone:
                    type: string
                  creationGroupPk:
                    type: integer
                    description: customer id for which the user was created
                  creationGroupName:
                    type: string
                    description: customer name for which the user was created
                  external:
                    type: boolean
                    description: user was authenticated by an external provider
                  roles:
                    type: object
                    description: roles are available only using a token not internal (not
                      exchanged with oauth)
                    additionalProperties:
                      type: array
                      items:
                        type: string
        "401":
          description: UNAUTHORIZED
  /service/customers:
    get:
      summary: Get the list of the customers for the user
      description: |
        Return the list of the customers of the user identified by the
        authentication token
      tags:
        - service
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/CustomerBasicResource"
        "401":
          description: UNAUTHORIZED
  "/service/customers/{groupPk}":
    get:
      summary: Verify that a user is associated with a customer
      description: |
        Verify that the user identified by the authentication token is
        associated with a customer
      tags:
        - service
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK the user is associated to the customer
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerBasicResource"
        "401":
          description: UNAUTHORIZED the token is invalid or expired
        "403":
          description: FORBIDDEN the user corresponding to the authentication token is not
            associated to the customer
        "404":
          description: NOT FOUND no customer exists for the given customerId
  /me:
    get:
      summary: Get user basic information
      description: >
        Search and retrive basic information for an user.

        Use the query parameter 'expand=platform' to get info about groups, workspaces and nodes
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: expand
          in: query
          description: >
            section to be expanded: set 'expand=platform' to get platform
            section data
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UserResource"
        "401":
          description: UNAUTHORIZED
  /user:
    get:
      summary: Get user personal info
      description: |
        Search and retrive personal info for an user
      tags:
        - user
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PersonalInfoResource"
        "401":
          description: UNAUTHORIZED
    put:
      summary: Update user personal info
      description: |
        Update personal info for an user
      tags:
        - user
      security:
        - clabPlatformOauth2:
            - USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PersonalInfoResource"
        "400":
          description: Invalid user resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        $ref: "#/components/requestBodies/PersonalInfoResource"
  /user/preferences:
    get:
      summary: Get user preferences
      description: |
        Search and retrive preferences for an user
      tags:
        - user
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreferencesResource"
        "401":
          description: UNAUTHORIZED
    put:
      summary: Update user preferences
      description: |
        Update preferences for an user
      tags:
        - user
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreferencesResource"
        "400":
          description: Invalid preferences resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        $ref: "#/components/requestBodies/PreferencesResource"
  /user/security/events:
    get:
      summary: Get user security events
      description: |
        Search and retrive security events for an user, order by date descending
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: size
          in: query
          description: |
            maximum elements to be retrieved
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page
          required: false
          schema:
            type: integer
        - name: type
          in: query
          description: |
            filter events by type
          required: false
          schema:
            type: string
        - name: exclude-app
          in: query
          description: |
            exclude apps from the events
          required: false
          schema:
            type: array
            items:
              type: string
        - name: from
          in: query
          description: date from
          schema:
            type: integer
        - name: to
          in: query
          description: date to
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/SecurityEventsResource"
        "400":
          description: Invalid preferences resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  /user/security/access:
    get:
      summary: Get first and last access for all apps used
      description: |
        Get first and last access for all apps used
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UserAppsAccessResource"
        "401":
          description: UNAUTHORIZED
  /user/security/password/info:
    get:
      summary: Get informations about password history
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  updateDate:
                    type: string
                    format: date
                  expireDate:
                    type: string
                    format: date
                  now:
                    type: string
                    format: date
        "401":
          description: UNAUTHORIZED
  /user/security/password/change:
    post:
      summary: change password
      description: change the old password with a new valid one
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
        "400":
          description: Invalid user resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - oldPassword
                - newPassword
              properties:
                oldPassword:
                  type: string
                  description: the old password
                newPassword:
                  type: string
                  description: the new password
        required: true
  /user/security/pin-status:
    get:
      summary: Get info about the activation of PIN
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  active:
                    type: boolean
                    description: true if pin is active, false otherwise
        "401":
          description: UNAUTHORIZED
  /user/security/phone/code:
    post:
      summary: request a verification code
      description: request a verification code for user mobile number that will be sent by
        sms
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: verification code already sent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "202":
          description: verification code sent by sms
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "401":
          description: UNAUTHORIZED
  /user/security/phone/verify:
    post:
      summary: verify verification code
      description: verify that the verification code is correct and code lifetime is less
        than 10 min
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: phone verified
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: verification code not sent
        "401":
          description: UNAUTHORIZED
        "403":
          description: verification code wrong or lifetime > 10min
      requestBody:
        $ref: "#/components/requestBodies/postUserSecurityPhoneVerify"
  /user/security/twofactor:
    get:
      summary: get two factor status
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: two factor status
          content:
            application/json:
              schema:
                type: object
                properties:
                  active:
                    type: boolean
        "401":
          description: UNAUTHORIZED
    put:
      summary: activate/deactivate two factor for pin
      tags:
        - user
        - security
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: status modified
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: the two factor can be activated only if cellphone is verified
        "401":
          description: UNAUTHORIZED
      requestBody:
        $ref: "#/components/requestBodies/putUserSecurityTwofactor"
  "/users/{userPk}":
    get:
      summary: Get info user
      description: |
        Get info about an user of the team
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/PersonalInfoResource"
                  - properties:
                      suspensionInfo:
                        type: object
                        properties:
                          date:
                            type: string
                          reason:
                            type: string
                            enum:
                              - PIN
                              - OTP
                              - PASSWORD
                              - ADMIN
                          suspendedBy:
                            type: object
                            description: userPk of the user who suspended, optional
                            properties:
                              userPk:
                                type: integer
                              name:
                                type: string
                              surname:
                                type: string
        "400":
          description: Invalid user resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
    put:
      summary: Modify info of user
      description: |
        Modify info about an user of the team
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PersonalInfoResource"
        "400":
          description: Invalid user resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
      requestBody:
        $ref: "#/components/requestBodies/PersonalInfoResource"
  "/users/{userPk}/suspension":
    put:
      summary: suspend or reactivate a user
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                suspended:
                  type: boolean
                  description: true to suspend, false to reactivate
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "404":
          description: User has not been found
  "/users/{userPk}/lockout":
    get:
      summary: retrieve info about lockout for user
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  lockedOut:
                    type: boolean
                  lockExpirationDate:
                    type: string
                    description: date of expiration for the lockout
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "404":
          description: User has not been found
    delete:
      summary: unlock user resetting lockout attempts
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "404":
          description: User has not been found
  "/users/{userPk}/customers":
    get:
      summary: Get associated customers
      description: |
        Get the list of associated customers for a user
      tags:
        - users
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum elements to be retrieved
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page
          required: false
          schema:
            type: integer
        - name: groupName
          in: query
          required: false
          description: value of the filter over groupName field
          schema:
            type: string
        - name: groupNameMode
          in: query
          required: false
          description: mode of the filter. | startsWith - search string stating with filter
            value default is containing
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomersResource"
        "400":
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
    post:
      summary: Associate customers
      description: |
        Associate a list of customers to an user
      tags:
        - users
        - customers
      security:
        - clabPlatformOauth2:
            - ADMIN
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: integer
                description: id to be associated
        required: true
    delete:
      summary: Remove customers association
      description: |
        Remove association of customers to an user
      tags:
        - users
        - customers
      security:
        - clabPlatformOauth2:
            - ADMIN
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
  "/users/{userPk}/preferences":
    get:
      summary: Get user preferences
      description: |
        Search and retrive preferences for an user of the team
      tags:
        - users
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreferencesResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
    put:
      summary: Update user preferences
      description: |
        Update preferences for an user of the team
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PreferencesResource"
        "400":
          description: Invalid preferences resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
      requestBody:
        $ref: "#/components/requestBodies/PreferencesResource"
  "/users/{userPk}/security/pin-reset":
    post:
      summary: Reset user Pin
      description: |
        Reset user Pin
      tags:
        - security
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: The pin has been reset and the mail with the new pin has been sent
            to the user
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: BAD REQUEST ( user is external )
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
  "/users/{userPk}/security/password-reset":
    post:
      summary: Reset user password
      description: |
        Reset user password
      tags:
        - security
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: The password has been reset and the mail with the new password has
            been sent to the user
          content:
            application/json:
              schema:
                allOf:
                  - $ref: "#/components/schemas/AcknowledgeResource"
                  - properties:
                      newPassword:
                        type: string
                        description: new generated password
        "400":
          description: BAD REQUEST ( user is external )
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "404":
          description: NOT FOUND ( user does not exist)
  "/users/{userPk}/security/events":
    get:
      summary: Security events for a single user
      description: |
        Get security events for the specified user
      tags:
        - security
        - users
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum elements to be retrieved
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page
          required: false
          schema:
            type: integer
        - name: type
          in: query
          description: |
            filter events by type
          required: false
          schema:
            type: string
        - name: from
          in: query
          description: date from
          schema:
            type: integer
        - name: to
          in: query
          description: date to
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SecurityEventsResource"
        "401":
          description: UNAUTHORIZED
  "/users/{userPk}/roles":
    get:
      summary: Get roles of applications for userPk
      description: |
        Get the map of roles the user has in all applications
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Roles"
        "400":
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
    put:
      summary: Assign roles
      description: >
        Assign roles for hub, plan and flow applications. Apply pattern for send
        roles.
      tags:
        - users
      security:
        - clabPlatformOauth2:
            - ADMIN
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
        "400":
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SingleRoles"
        required: true
  /customers:
    get:
      summary: Get customers
      description: |
        Return list of customers associated with logged user
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: size
          in: query
          description: |
            maximum customers in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: name
          in: query
          description: |
            filter for group name
          required: false
          schema:
            type: string
        - name: excludeUserPk
          in: query
          description: |
            exclude all groups associated to the userPk
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomersResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/ancestors":
    get:
      summary: Get customers
      description: |
        Return list of parents of the selected customer
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum customers in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: name
          in: query
          description: |
            filter for group name
          required: false
          schema:
            type: string
        - name: excludeUserPk
          in: query
          description: |
            exclude all groups associated to the userPk
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomersResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}":
    get:
      summary: Get customer
      description: |
        Return full info for customer
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
    put:
      summary: Update customer
      description: |
        Update info of customer
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            customer to update
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerResource"
        "400":
          description: Invalid user resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CustomerResource"
        required: true
    patch:
      summary: Partial update customer (only status)
      description: |
        Update status of customer
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            customer to update
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerResource"
        "400":
          description: Invalid status
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PatchCustomerInfoResource"
        required: true
  "/customers/{groupPk}/users":
    get:
      summary: Get users associated with owned customers
      description: |
        Return list of users of a customer/sub-customers
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum user in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: sort
          in: query
          description: |
            sort by column, by default asc sorting
          required: false
          schema:
            type: string
        - name: search
          in: query
          description: |
            fulltext search in name, surname, username or email
          required: false
          schema:
            type: string
        - name: userType
          in: query
          description: |
            when present, filter on user type:
              * INTERACTIVE: users that can login
              * APPLICATION: credentials for applications
          required: false
          schema:
            type: string
            enum:
              - INTERACTIVE
              - APPLICATION
        - name: status
          in: query
          description: |
            when present, filter on on user status:
              * ACTIVE
              * SUSPENDED
              * DISABLED
          required: false
          schema:
            type: string
            enum:
              - ACTIVE
              - SUSPENDED
              - DISABLED
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UsersResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
    post:
      summary: Create user
      description: |
        Create user associated with customer
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - ADMIN
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: User created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                name:
                  type: string
                surname:
                  type: string
                email:
                  type: string
                language:
                  type: string
                sex:
                  type: string
                send:
                  type: string
                  description: SEND role to assign to the new user, can be 'default'
                    'noSend', 'onlyStat'. | if null the user will have blank
                    permission
                hub:
                  type: string
                  description: role for HUB
                cplan:
                  type: string
                  description: role for PLAN
                flow:
                  type: string
                  description: role for FLOW
              required:
                - username
                - name
                - surname
                - email
                - language
                - sex
        description: |
          data for user creation
        required: true
  "/customers/{groupPk}/application-users":
    get:
      summary: Get application users associated with owned customers with secret
        creation informations
      description: >
        Return list of application users of a customer with secret creation
        information
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum user in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: sort
          in: query
          description: |
            sort by column, by default asc sorting
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApplicationUsersResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/users/applications":
    get:
      summary: List of users that have used any application for a customer
      description: >
        Return list of users that have used any application for a customer and
        the first and last access time
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum user in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UsersAccessResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/users/applications/{application}":
    get:
      summary: List of users that have used an application for a customer
      description: >
        Return list of users that have used an application for a customer and
        the first and last access time
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: application
          in: path
          description: >
            application used for the customer  (cdata, cplan, flow,
            hub, send, srr)
          required: true
          schema:
            type: string
        - name: size
          in: query
          description: |
            maximum user in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UsersApplicationAccessResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/users/issues":
    get:
      summary: Get users associated with owned customers that have issues
      description: |
        Return list of users of a customer/sub-customers that have issues
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum user in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: sort
          in: query
          description: |
            sort by column, by default asc sorting
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UsersIssuesResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/users/issues/failed-logins":
    get:
      summary: Get users associated with owned customers that have failed logins
      description: >
        Return list of users of a customer/sub-customers that have failed logins
        and serveral consecutive failed logins
      tags:
        - customers
        - security
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum user in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: sort
          in: query
          required: false
          schema:
            type: string
        - name: days
          in: query
          description: |
            specify the range to check the logins can be from 1 to 30 days
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UsersSecurityEvents"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/configuration":
    get:
      summary: Get customer configuration
      description: |
        Return customer configuration
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerConfiguration"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/configuration/sftp":
    get:
      summary: Get customer configuration for sftp
      tags:
        - customers
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerConfigurationSftp"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/configuration/applications":
    get:
      summary: Get customer applications configurations
      description: |
        Return customer applications configurations
      tags:
        - customers
        - applications
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerApplications"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/configuration/applications/{application}":
    get:
      summary: Get customer specific application configurations
      description: |
        Return customer application configurations
      tags:
        - customers
        - applications
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: application
          in: path
          description: |
            target application
          required: true
          schema:
            type: string
      responses:
        "200":
          description: Return a subset of CustomerApplications resource based con
            application path variable
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/applications/hub/workspaces/{workspaceId}/distribution-customer-source":
    get:
      summary: Get the counters for an hub workspace
      description: |
        Get the counters for nodes and sources in an hub workspace
      tags:
        - customers
        - applications
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: workspaceId
          in: path
          description: |
            target workspaceId
          required: true
          schema:
            type: integer
        - name: nodes
          in: query
          description: |
            nodes to be considered
          required: false
          schema:
            type: array
            items:
              type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        nodeId:
                          type: string
                        count:
                          type: integer
                        values:
                          type: array
                          items:
                            type: object
                            properties:
                              count:
                                type: integer
                              sourceId:
                                type: string
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/dkims":
    get:
      summary: Get customers dkims
      description: |
        Return customer dkims.
      tags:
        - customers
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
            - DKIM
            - USER
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: size
          in: query
          description: |
            maximum items in the page
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: |
            page to return
          required: false
          schema:
            type: integer
        - name: domain
          in: query
          description: |
            Filter the dkims by the specified domain
          required: false
          schema:
            type: string
        - name: default
          in: query
          description: |
            Filter the dkims by the specified value
          required: false
          schema:
            type: boolean
        - name: active
          in: query
          description: |
            Filter the dkims by active value
          required: false
          schema:
            type: boolean
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DkimsResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
    post:
      summary: Register a new dkim
      description: |
        Register a new dkim
      tags:
        - customers
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: Dkim registered
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "409":
          description: "Conflict: the dkim already exist for the given domain"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DkimData"
        required: true
  "/customers/{groupPk}/dkims/{dkimId}":
    get:
      summary: Get customer dkim by id
      description: |
        Return customer dkim.
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
            - DKIM
            - USER
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: dkimId
          in: path
          description: |
            dkim id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DkimResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
    patch:
      summary: Update dkim
      description: |
        Update dkim.
      tags:
        - customers
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: dkimId
          in: path
          description: |
            dkim id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DkimData"
        required: true
    delete:
      summary: Delete a dkim
      description: |
        Delete a dkim.
      tags:
        - customers
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: dkimId
          in: path
          description: |
            dkim id
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid resource
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/dkims/default":
    put:
      summary: Set customer default dkim
      description: |
        Set customer default dkim
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: Invalid id
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                id:
                  type: integer
                  description: id of the default dkim
              required:
                - id
  "/customers/{groupPk}/dkim":
    get:
      summary: Get signing dkim by domain
      description: |
        Returns signing Dkim by domain. Default Dkim is returned if domain is not specified. Platform Dkim is returned if the customer does not have any custom Dkims.
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
            - DKIM
            - USER
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
        - name: domain
          in: query
          description: |
            sender domain to get the dkim from
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DkimResource"
        "401":
          description: UNAUTHORIZED
  "/customers/{groupPk}/signed-messages":
    post:
      summary: Apply the DKIM signature(s) to an email message
      description: |
        Apply the neccessary DKIM signature(s) to an email message. The correct signing
        key is selected as follows
        - If the customer has multiple signing keys the one exactly matching the sender
          domain is used
        - If the cusotmer has only a signing key or if no one of the customer keys
          matches exacly the sender domain then the customer's default key is used
        - If the customer has no key the default for the contactlab platform is used
        For recipient domain tha need an FBL the relevant signature is applied as well.
      tags:
        - dkim
        - customer
      parameters:
        - name: groupPk
          in: path
          description: |
            target groupPk
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/MessageSigningRequest"
      responses:
        "200":
          description: "OK"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/SignedMessageResource"
        "400":
          description: |
            The message signing request ontains invalid data (invalid email messages
            or invalid email addresses)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
  /platform/customers/dkims:
    get:
      summary: Retrieve all customer DKIMs
      description: |
        Retrieve a paged collection of all customer DKIMs. The collection
        is sorted by acending cusotmer ID and domain name
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: page
          in: query
          description: the page to retrieve
          required: false
          schema:
            type: integer
        - name: size
          in: query
          description: the page size
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerDkimsResource"
        "401":
          description: UNAUTHORIZED
  /platform/dkim:
    get:
      summary: Get platform dkim
      description: |
        Return platform dkim.
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
            - DKIM
            - USER
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformDkimResource"
        "401":
          description: UNAUTHORIZED
        "409":
          description: CONFLICT multiple platform dkim configuration found
    put:
      summary: Update platform dkim
      description: |
        Update platform dkim
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PlatformDkimResource"
        "400":
          description: Invalid body
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/PlatformDkimResource"
  /platform/fbls:
    get:
      summary: Get fbls
      description: |
        Return fbls.
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
            - DKIM
            - USER
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FblsResource"
        "401":
          description: UNAUTHORIZED
    post:
      summary: Create Fbl
      description: |
        Create Fbl
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FblResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "409":
          description: Conflict
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FblSource"
  /platform/fbls/{uuid}:
    patch:
      summary: Update Fbl
      description: |
        Update Fbl
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: uuid
          in: path
          description: |
            target uuid
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FblResource"
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "404":
          description: NOT_FOUND
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/FblSource"
    delete:
      summary: Delete fbls
      description: |
        delete fbls.
      tags:
        - dkim
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: uuid
          in: path
          description: |
            target uuid
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN
        "404":
          description: NOT_FOUND
  /options/user/preferences:
    get:
      summary: Allowed options for user preferences
      description: |
        Get all allowed options for user preferences fields
      tags:
        - user
        - options
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/UserPreferencesOptions"
  /options/customer/preferences:
    get:
      summary: Allowed options for customer preferences
      description: |
        Get all allowed options for customer preferences fields
      tags:
        - customers
        - options
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerPreferencesOptions"
  /options/sites:
    get:
      summary: Sites related to contactlab
      description: |
        Get all Sites related to contactlab (applications, network and social)
      tags:
        - options
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  applications:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        clientId:
                          type: string
                        url:
                          type: string
                        urlExplore:
                          type: string
                        logo:
                          type: string
                        description:
                          type: string
                  networkSites:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        url:
                          type: string
                  socialSites:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                        url:
                          type: string
                        logo:
                          type: string
  /options/applications:
    get:
      summary: Applications of contactlab platform
      description: |
        Get all applications available in contactlab, based on environment
      tags:
        - options
        - applications
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    clientId:
                      type: string
                    url:
                      type: string
                    urlExplore:
                      type: string
                    logo:
                      type: string
                    description:
                      type: string
  /options/network-sites:
    get:
      summary: network sites of contactlab
      description: |
        Get all network sites related to contactlab
      tags:
        - options
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    url:
                      type: string
  /options/social-sites:
    get:
      summary: social sites of contactlab
      description: |
        Get all social sites of contactlab
      tags:
        - options
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    url:
                      type: string
                    logo:
                      type: string
  /options/app-roles:
    get:
      summary: app roles
      description: |
        app roles used during creation of user
      tags:
        - options
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
                    description: role name
  /notifications:
    get:
      summary: Get notifications
      description: >
        Return list of notifications related with logged user, order by date desc
      tags:
        - notifications
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: page
          in: query
          required: false
          schema:
            type: integer
        - name: size
          in: query
          description: |
            total notifications to return
          required: false
          schema:
            type: integer
        - name: notRead
          in: query
          description: |
            flag, if true return only the notifications not already read
          required: false
          schema:
            type: boolean
        - name: priority
          in: query
          required: false
          schema:
            type: string
        - name: application
          in: query
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/NotificationResource"
        "400":
          description: Invalid size
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResource"
        "401":
          description: UNAUTHORIZED
    post:
      summary: Enqueue a new notification
      description: |
        Enqueue a new notification that will be consumed later asynchronously
      tags:
        - notifications
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      responses:
        "200":
          description: Notification enqueued
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NotificationBodyRequest"
        "400":
          description: BAD REQUEST, body params not valid
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NotificationBodyRequest"
        required: true
  /notifications/read:
    post:
      summary: Mark notifications as read
      description: |
        Mark the notifications linked to the provided ids as read
      tags:
        - notifications
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "401":
          description: UNAUTHORIZED
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                type: integer
                description: id to be marked
        required: true
  /notifications/subscribe:
    get:
      summary: Subcribe to get push notifications
      description: |
        Subscribe through sse to get platform notifications
      tags:
        - notifications
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                description: sse emitter
        "401":
          description: UNAUTHORIZED
  /news:
    get:
      summary: Get news
      description: |
        Return list of news, order by publish date descending
      tags:
        - news
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: page
          in: query
          required: false
          schema:
            type: integer
        - name: size
          in: query
          description: |
            total notifications to return
          required: false
          schema:
            type: integer
        - name: category
          in: query
          required: false
          description: filter news which have categories with one of the id provided
          schema:
            type: array
            items:
              type: integer
        - name: lang
          in: query
          required: false
          description: override user lang, if invalid fallback to en language, supported
            ['it', 'en']
          schema:
            type: string
            enum:
              - it
              - en
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/NewsResource"
    post:
      summary: Trigger update from explora
      description: |
        Trigger update from explora
      tags:
        - news
      security:
        - clabPlatformOauth2: []
      responses:
        "200":
          description: OK
        "401":
          description: UNAUTHORIZED
  "/users/{userPk}/security/phone/code":
    post:
      summary: request a verification code for specific user
      description: request a verification code for user mobile number that will be sent by
        sms
      tags:
        - users
        - security
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: verification code already sent
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "202":
          description: verification code sent by sms
        "401":
          description: UNAUTHORIZED
  "/users/{userPk}/security/phone/verify":
    post:
      summary: verify verification code for a user
      description: verify that the verification code is correct and code lifetime is less
        than 10 min
      tags:
        - users
        - security
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: phone verified
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: verification code not sent
        "401":
          description: UNAUTHORIZED
        "403":
          description: verification code wrong or lifetime > 10min
      requestBody:
        $ref: "#/components/requestBodies/postUserSecurityPhoneVerify"
  "/users/{userPk}/security/twofactor":
    get:
      summary: get two factor status for specific user
      tags:
        - users
        - security
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      responses:
        "200":
          description: two factor status
          content:
            application/json:
              schema:
                type: object
                properties:
                  active:
                    type: boolean
        "401":
          description: UNAUTHORIZED
    put:
      summary: activate/deactivate two factor for pin for a specific user
      tags:
        - users
        - security
      security:
        - clabPlatformOauth2: []
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: status modified
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: the two factor can be activated only if cellphone is verified
        "401":
          description: UNAUTHORIZED
      requestBody:
        $ref: "#/components/requestBodies/putUserSecurityTwofactor"
  "/health/{application}/status":
    get:
      summary: Get status of the application
      tags:
        - applications
        - status
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: application
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: application status
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: Enum, can be "UP" or "DOWN"
                    enum:
                      - UP
                      - DOWN
        "401":
          description: UNAUTHORIZED
        "404":
          description: NOT FOUND
    post:
      summary: Sets status of the application
      tags:
        - applications
        - status
      security:
        - clabPlatformOauth2:
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: application
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: application status changed
          content:
            application/json:
              schema:
                type: object
                properties:
                  result:
                    type: string
                  resultCode:
                    type: string
                  timestamp:
                    type: integer
        "400":
          description: BAD REQUEST (status value is not "UP" or "DOWN")
        "401":
          description: UNAUTHORIZED
        "403":
          description: FORBIDDEN (only CustomerCare can change the status)
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  description: Enum, can be "UP" or "DOWN"
                  enum:
                    - UP
                    - DOWN
        required: true
  "/health/{application}/status/subscribe":
    get:
      summary: Subscribes to an application status changes SSE notification
      description: >
        The client application opens an EventSource connection to the path to
        receive notifications from AccountCentral
      tags:
        - applications
        - status
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: application
          in: path
          required: true
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AppStatusEventSource"
        "401":
          description: UNAUTHORIZED
  /user/role:
    get:
      summary: User role for account AccountCentral
      description: Returns the user role in AccountCentral for the given customer. The role
        is assigned to specific customer using the user capabilities.
      tags:
        - user
      security:
        - clabPlatformOauth2:
            - USER
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          in: query
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  role:
                    type: string
                    enum:
                      - CUSTOMER_CARE
                      - ADMIN
                      - USER
        "401":
          description: UNAUTHORIZED token invalid or expired
        "403":
          description: UNAUTHORIZED the user is not associated with the given customer
  "/users/{userPk}/capabilities":
    post:
      summary: Grant capability
      description: |
        Grant the given capability to the user
      tags:
        - users
        - capabilities
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: OK capability granted
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "400":
          description: BAD REQUEST
        "401":
          description: UNAUTHORIZED token invalid or expired
        "403":
          description: FORBIDDEN the authenticated user is not an administrator of the
            target user
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                application:
                  type: string
                  description: client id of the application
                version:
                  type: integer
                  description: version of the capabilities schema for the application
                resource:
                  type: array
                  description: path of the resource for the given capabilities schema
                  items:
                    type: string
                    description: path components
                role:
                  type: string
                  description: role granted to the resource
        required: true
  "/users/{userPk}/capabilities/{id}":
    delete:
      summary: Revoke capability
      description: |
        Revoke the given capability to the user
      tags:
        - users
        - capabilities
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK capability revoked
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AcknowledgeResource"
        "401":
          description: UNAUTHORIZED token invalid or expired
        "403":
          description: FORBIDDEN the authenticated user is not an administrator of the
            target user
        "404":
          description: NOT FOUND capability not found
  "/users/{userPk}/capabilities/history":
    get:
      summary: User capability log
      description: Return the history of all capabilities granted and revoked to the user
      tags:
        - users
        - capabilities
      security:
        - clabPlatformOauth2:
            - POWER_USER
            - ADMIN
            - CUSTOMER_CARE
      parameters:
        - name: userPk
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK capability revoked
          content:
            application/json:
              schema:
                type: object
                properties:
                  page:
                    type: object
                    properties:
                      size:
                        type: integer
                        description: Size of the page
                      totalElements:
                        type: integer
                        description: Total elements in the collection
                      totalUnfilteredElements:
                        type: integer
                        description: Total elements in the unfiltered collection
                      totalPages:
                        type: integer
                        description: Total pages of the collection
                      number:
                        type: integer
                        description: Number of the current page
                  elements:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: integer
                          description: id  of the capability
                        application:
                          type: string
                          description: client id of the application
                        version:
                          type: integer
                          description: version of the capabilities schema for the
                            application
                        resource:
                          type: array
                          description: path of the resource for the given capabilities
                            schema
                          items:
                            type: string
                            description: path components
                        role:
                          type: string
                          description: role granted to the resource
                        operation:
                          type: string
                          enum:
                            - GRANT
                            - REVOKE
                        versionDate:
                          type: string
                        versionBy:
                          type: object
                          properties:
                            userPk:
                              type: integer
                            name:
                              type: string
                            surname:
                              type: string
        "401":
          description: UNAUTHORIZED token invalid or expired
        "403":
          description: FORBIDDEN the authenticated user is not an administrator of the
            target user nor has customer care role
        "404":
          description: NOT FOUND user not found
  /internal/capabilities:
    get:
      summary: User capabilities to support oauth2 authentication server
      description: Return the user capabilities that will be used from the authorization
        server. This endpoint is dedicated to the authorization server.
      tags:
        - internal
        - capabilities
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                  additionalProperties:
                    type: object
        "401":
          description: UNAUTHORIZED token invalid or expired
        "404":
          description: NOT FOUND user not found
  /jobs:
    summary: customer provisioning
    get:
      summary: get the list of customer provisioning jobs
      tags:
        - provisioning
        - platform
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: groupPk
          description: filter jobs by customer id
          in: query
          required: false
          schema:
            type: integer
        - name: page
          in: query
          description: the page number in the collection, starting from 0
          required: false
          schema:
            type: integer
        - name: size
          in: query
          description: |
            the collection's page size
          required: false
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/JobCollectionResource"
        "401":
          description: UNAUTHORIZED token is invalid or expired, or user has not the CUSTOMER_CARE role
    post:
      summary: create a new job
      tags:
        - provisioning
        - platform
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/NewCustomerJobResource"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerJobResource"
        "401":
          description: UNAUTHORIZED token is invalid or expired, or user has not the CUSTOMER_CARE role
  "/jobs/{jobId}":
    get:
      summary: get the job's details
      tags:
        - provisioning
        - platform
      security:
        - clabPlatformOauth2:
            - CUSTOMER_CARE
      parameters:
        - name: "jobId"
          in: path
          description: the job unique id
          required: true
          schema:
            type: string
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomerJobResource"
        "401":
          description: UNAUTHORIZED token is invalid or expired, or user has not the CUSTOMER_CARE role
        "404":
          description: the requested job could not be found
components:
  requestBodies:
    PreferencesResource:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PreferencesResource"
      required: true
    PersonalInfoResource:
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/PersonalInfoResource"
      required: true
    postUserSecurityPhoneVerify:
      content:
        application/json:
          schema:
            type: object
            required:
              - code
            properties:
              code:
                type: integer
                description: verification code
      required: true
    putUserSecurityTwofactor:
      content:
        application/json:
          schema:
            type: object
            properties:
              active:
                type: boolean
                description: two factor status
      required: true
  securitySchemes:
    clabPlatformOauth2:
      type: oauth2
      description: Oauth2 platform login as described in documentation on Confluence
      flows:
        implicit:
          authorizationUrl: https://login.contactlab.it/o/oauth2/auth
          scopes:
            USER: basic role implicity given to all platform users, with the ability
              to see basic information about his profile and his customers
            POWER_USER: a user that can read all the information of the customers to which
              is associated but cannot give access to resources or administer
              users
            ADMIN: admin of a customer using the platform, has the power to give
              accesses to customer resources of his customer
            CUSTOMER_CARE: role for internal administration employers, can see every group
              and user
            DKIM: role for dkims that can see private key
        clientCredentials:
          tokenUrl: https://login.contactlab.it/o/oauth2/token
          scopes:
            USER: basic role implicity given to all platform users, with the ability
              to see basic information about his profile and his customers
            POWER_USER: a user that can read all the information of the customers to which
              is associated but cannot give access to resources or administer
              users
            ADMIN: admin of a customer using the platform, has the power to give
              accesses to customer resources of his customer
            CUSTOMER_CARE: role for internal administration employers, can see every group
              and user
            DKIM: role for dkims that can see private key
  schemas:
    AppStatusEventSource:
      type: object
      properties:
        data:
          type: object
          properties:
            application:
              type: string
            status:
              type: string
              description: Enum, can be "UP" or "DOWN"
    UserTickets:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
                description: id  of the ticket
              createdAt:
                type: string
                description: date of creation, ex. "2017-01-09T09:21:23Z"
              updatedAt:
                type: string
                description: date of last update, ex. "2017-01-09T09:21:23Z"
              subject:
                type: string
                description: subject of the ticket
              description:
                type: string
                description: description of the ticket
              status:
                type: string
                description: status of the ticket
      required:
        - elements
    UsersResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              userPk:
                type: integer
              name:
                type: string
                description: name of the user
              surname:
                type: string
                description: surname of the user
              email:
                type: string
                description: email of the user
              username:
                type: string
                description: username of the user
              groupName:
                type: integer
              readOnly:
                type: boolean
              status:
                type: string
                enum:
                  - ACTIVE
                  - SUSPENDED
                  - INACTIVE
              userType:
                type: string
                enum:
                  - INTERACTIVE
                  - APPLICATION
              lastLogin:
                type: integer
      required:
        - elements
    ApplicationUsersResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              uid:
                type: string
                description: uid of the user
              username:
                type: string
                description: username of the user
              status:
                type: string
                enum:
                  - ACTIVE
                  - DISABLED
                  - SUSPENDED
              creationDate:
                type: integer
                description: user creation date
              secretCreationDate:
                type: integer
                description: date of last secret reset
              secretCreatedBy:
                type: object
                description: information about the last user that reset the secret
                properties:
                  userPk:
                    type: integer
                    description: userPk of the last user that reset the secret
                  name:
                    type: string
                    description: name of the last user that reset the secret
                  surname:
                    type: string
                    description: name of the last user that reset the secret
      required:
        - elements
    UsersIssuesResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              userPk:
                type: integer
              name:
                type: string
                description: name of the user
              surname:
                type: string
                description: surname of the user
              email:
                type: string
                description: email of the user
              username:
                type: string
                description: username of the user
              groupName:
                type: integer
              issues:
                type: array
                items:
                  type: string
                  description: list of issues, can be 'USER_SUSPENDED', 'PIN_INACTIVE',
                    'PASSWORD_BLOCKED'
    UsersAccessResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              userPk:
                type: integer
              name:
                type: string
                description: name of the user
              surname:
                type: string
                description: surname of the user
              email:
                type: string
                description: email of the user
              username:
                type: string
                description: username of the user
              groupName:
                type: string
              loginInfo:
                type: object
                additionalProperties:
                  type: object
                  description: first access and last access for each application
    UsersApplicationAccessResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              userPk:
                type: integer
              name:
                type: string
                description: name of the user
              surname:
                type: string
                description: surname of the user
              email:
                type: string
                description: email of the user
              username:
                type: string
                description: username of the user
              groupName:
                type: string
              loginInfo:
                type: object
                properties:
                  firstAccess:
                    type: integer
                    description: first access of the user to the application for that
                      customer
                  lastAccess:
                    type: integer
                    description: first access of the user to the application for that
                      customer
    UserAppsAccessResource:
      type: object
      additionalProperties:
        type: object
        properties:
          firstAccess:
            type: string
          lastAccess:
            type: string
    CustomersResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            $ref: "#/components/schemas/CustomerBasicResource"
      required:
        - elements
    CustomerBasicResource:
      type: object
      properties:
        groupPk:
          type: integer
          description: groupk of the customer
        groupName:
          type: string
          description: name of the customer
        status:
          type: string
          enum:
            - ACTIVE
            - SUSPENDED
            - INACTIVE
        chatEnabled:
          type: boolean
    CustomerResource:
      type: object
      properties:
        name:
          type: string
          description: name of customer
        address:
          type: string
          description: address of the customer
        country:
          type: string
          description: country of the customer
        phone:
          type: string
          description: phone number of the customer
        platformResponsible:
          type: string
          description: email of the platform responsible
        technicalResponsible:
          type: string
          description: email of the technical responsible
        privacyResponsible:
          type: string
          description: email of the privacy responsible
        status:
          type: string
          enum:
            - ACTIVE
            - SUSPENDED
            - INACTIVE
        premium:
          type: boolean
        gid:
          type: string
          description: group id of customer
    PatchCustomerInfoResource:
      type: object
      properties:
        status:
          type: string
          enum:
            - ACTIVE
            - SUSPENDED
            - INACTIVE
    CustomerConfiguration:
      type: object
      properties:
        gid:
          type: string
        apiKey:
          type: object
          properties:
            value:
              type: string
              description: api key value
            enable:
              type: boolean
              description: true if api key is enable, false otherwise
        smartRelayEnable:
          type: boolean
          description: true if the customer have a smart relay enabled, false
        genericUsers:
          type: array
          items:
            type: object
            properties:
              username:
                type: string
              email:
                type: string
              uid:
                type: string
        dataExchanges:
          type: array
          items:
            type: object
            properties:
              configId:
                type: integer
                description: id of the data exchange
              name:
                type: string
                description: name of the data exchange
              app:
                type: string
                description: type of data exchange, can be data-exchange.importer,
                  data-exchange.exporter, data-exchange.updater,
                  data-exchange.displacer and contactlab.xml-delivery2
              lastExecutionDate:
                type: string
                description: date of last execution of the data exchange in ISO 8601
              status:
                type: integer
                description: status of data exchange, 1 is enable -1 otherwise
    CustomerConfigurationSftp:
      type: array
      items:
        type: object
        properties:
          name:
            type: string
          updatedOn:
            type: integer
          createdOn:
            type: integer
          port:
            type: integer
          proto:
            type: string
          host:
            type: string
          ip:
            type: array
            items:
              type: string
          user:
            type: string
          publicKey:
            type: string
    PersonalInfoResource:
      type: object
      properties:
        userPk:
          type: integer
        name:
          type: string
        surname:
          type: string
        username:
          type: string
          description: cannot be changed
        email:
          type: string
        groupName:
          type: string
        phone:
          type: string
        cellPhone:
          type: string
        dateOfBirth:
          type: string
        sex:
          type: string
          description: M for Male, F for Female
        cellPhoneVerified:
          type: boolean
        status:
          type: string
          enum:
            - ACTIVE
            - SUSPENDED
            - DISABLED
          description: >
            * ACTIVE: user can login

            * SUSPENDED: user cannot login because has been blocked on the base of a suspicious activity with his/her account

            * DISABLED: the accunt has been disabled by an explicit action of an administrator
        userType:
          type: string
          enum:
            - INTERACTIVE
            - APPLICATION
          description: |
            * INTERACTIVE: a user that can login
            * APPLICATION: credentials for an application
    PreferencesResource:
      type: object
      properties:
        timezone:
          type: string
        language:
          type: string
        weekBegin:
          type: string
        numberFormat:
          type: object
          properties:
            decimal:
              type: string
              description: decimal format style, can be comma or dot
            grouping:
              type: string
              description: grouping format style
        dateFormat:
          type: object
          properties:
            separator:
              type: string
              description: date separator (- /)
            order:
              type: string
              description: date order(ymd dmy)
        hourFormat:
          type: object
          properties:
            format:
              type: string
              description: hh:mm or hh:mm:ss
            type:
              type: string
              description: 12 or 24
    UserPreferencesOptions:
      type: object
      properties:
        timezones:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                description: name of the timezone in "continent/city" format
              hourOffset:
                type: integer
                description: timezone offset
              offset:
                type: integer
                description: timezone offset in ms
              dstSavings:
                type: string
                description: dst savings in ms
              useDayligth:
                type: boolean
        weekBegin:
          type: array
          items:
            type: string
        languages:
          type: array
          items:
            type: object
            properties:
              label:
                type: string
              value:
                type: string
        numberFormat:
          type: object
          properties:
            decimal:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  example:
                    type: string
            grouping:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  example:
                    type: string
        dateFormat:
          type: object
          properties:
            separator:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  example:
                    type: string
            order:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  example:
                    type: string
        hourFormat:
          type: object
          properties:
            format:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  example:
                    type: string
            type:
              type: array
              items:
                type: object
                properties:
                  value:
                    type: string
                  example:
                    type: string
    HubConfiguration:
      type: object
      properties:
        configured:
          type: boolean
          description: true if the app is configured for the customer
        workspaces:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              name:
                type: string
              status:
                type: string
              nodes:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - entry
                        - view
                        - aggregate
                      description: node type, e.g entry, view
                    id:
                      type: string
                    name:
                      type: string
                    planSource:
                      $ref: "#/components/schemas/PlatformSource"
                    sendSource:
                      $ref: "#/components/schemas/PlatformSource"
                    otherSources:
                      type: array
                      items:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                          type:
                            type: string
                    children:
                      type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - entry
                              - view
                            description: node type, e.g entry, view
                          id:
                            type: string
                          name:
                            type: string
                    entries:
                      type: array
                      items:
                        type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - entry
                            description: node type
                          id:
                            type: string
                          name:
                            type: string
                    matchingProperties:
                      type: array
                      items:
                        type: string
                      description: " the list of properties used for matching elements in
                        the entry nodes this node is an aggregation of"
    PlanConfiguration:
      type: object
      properties:
        configured:
          type: boolean
          description: true if the app is configured for the customer
        tenants:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              label:
                type: string
              groupPk:
                type: integer
              userDbId:
                type: integer
              userDbName:
                type: string
              creationDate:
                type: string
              blacklistedUsersCount:
                type: integer
    SendConfiguration:
      type: object
      properties:
        userDbs:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
              usersCount:
                type: integer
              baseFilteredUsersCount:
                type: integer
    CustomerApplications:
      type: object
      properties:
        hub:
          $ref: "#/components/schemas/HubConfiguration"
        plan:
          $ref: "#/components/schemas/PlanConfiguration"
        send:
          $ref: "#/components/schemas/SendConfiguration"
    CustomerPreferencesOptions:
      type: object
      properties:
        countries:
          type: array
          items:
            type: string
            description: list of countries
    UsersSecurityEvents:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              userPk:
                type: integer
              name:
                type: string
              surname:
                type: string
              username:
                type: string
              email:
                type: string
              groupName:
                type: string
              failedLogins:
                type: object
                properties:
                  count:
                    type: integer
                    description: number of failed logins
                  oldestEventTimestamp:
                    type: integer
                    description: timestamp of oldest login of the consecutive cluster
                  latestEventTimestamp:
                    type: integer
                    description: timestamp of latest login of the consecutive cluster
                  elements:
                    type: array
                    items:
                      type: object
                      properties:
                        idEvent:
                          type: integer
                        userPk:
                          type: integer
                        timestamp:
                          type: integer
                        ip:
                          type: string
                        country:
                          type: string
                        destinationApp:
                          type: string
                        eventType:
                          type: string
                        browser:
                          type: string
                        browserVersion:
                          type: string
                        deviceName:
                          type: string
                        deviceType:
                          type: string
                        operatingSystem:
                          type: string
                        operatingSystemVersion:
                          type: string
              maxConsecutiveFailedLogins:
                type: object
                properties:
                  count:
                    type: integer
                    description: number of consecutive failed logins
                  elements:
                    type: array
                    items:
                      type: object
                      properties:
                        idEvent:
                          type: integer
                        userPk:
                          type: integer
                        timestamp:
                          type: integer
                        ip:
                          type: string
                        country:
                          type: string
                        destinationApp:
                          type: string
                        eventType:
                          type: string
                        browser:
                          type: string
                        browserVersion:
                          type: string
                        deviceName:
                          type: string
                        deviceType:
                          type: string
                        operatingSystem:
                          type: string
                        operatingSystemVersion:
                          type: string
    UserResource:
      type: object
      properties:
        userPk:
          type: integer
        name:
          type: string
        surname:
          type: string
        username:
          type: string
        email:
          type: string
        picture:
          type: string
        lang:
          type: string
        timezone:
          type: string
        creationGroupPk:
          type: integer
          description: customer id for which the user was created
        creationGroupName:
          type: string
          description: customer name for which the user was created
        external:
          type: boolean
          description: user was authenticated by an external provider
        roles:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        platform:
          description: |
            groups, workspaces, nodes for the user
            set 'expand=platform' to get data in this section
          type: object
          properties:
            groups:
              type: array
              items:
                anyOf:
                  - $ref: "#/components/schemas/SendGroupInfo"
                  - $ref: "#/components/schemas/PlanGroupInfo"
                  - $ref: "#/components/schemas/McGroupInfo"
    SendGroupInfo:
      type: object
      properties:
        kind:
          type: string
          enum: [mc, sendPlan, sendOnly]
          default: sendOnly
        id:
          type: integer
          minimum: 0
          description: unique identifier of group
          example: 12
        name:
          type: string
          description: name of group
          example: Company A
    PlanGroupInfo:
      type: object
      properties:
        kind:
          type: string
          enum: [mc, sendPlan, sendOnly]
          default: sendPlan
        id:
          type: integer
          minimum: 0
          description: unique identifier of group
          example: 12
        name:
          type: string
          description: name of group
          example: Company A
        tenants:
          type: array
          items:
            $ref: "#/components/schemas/TenantInfo"
    TenantInfo:
      type: object
      properties:
        id:
          type: string
          description: unique identifier of tenant
        name:
          type: string
          description: tenant name
    McGroupInfo:
      type: object
      properties:
        kind:
          type: string
          enum: [mc, sendPlan, sendOnly]
          default: mc
        id:
          type: integer
          minimum: 0
          description: unique identifier of group
          example: 12
        name:
          type: string
          description: name of group
          example: Company A
        workspaces:
          type: array
          items:
            $ref: "#/components/schemas/WorkspaceInfo"
    WorkspaceInfo:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: unique identifier of workspace
        name:
          type: string
          description: name of workspace
          example: Toys & Toys
        status:
          type: string
          description: status of the workspace
          enum:
            - ENABLED
            - DISABLED
          example: ENABLED
        dbOffline:
          type: boolean
          description: status of the workspaces's database
          example: false
        nodes:
          type: array
          items:
            $ref: "#/components/schemas/NodeResource"
    NodeResource:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: unique identifier of node
        name:
          type: string
          description: the name of node
          example: Node 1
        permission:
          type: string
          enum:
            - R
            - RW
            - W
          default: R
          description: permission mode
          example: RW
        type:
          type: string
          enum:
            - ENTRY
            - AGGREGATE
            - VIEW
          description: type of the node
          example: ENTRY
        tenantId:
          type: string
          description: tenant unique identifier
    Roles:
      type: object
      description: Roles for each application
      additionalProperties:
        type: array
        items:
          type: string
    SingleRoles:
      type: object
      description: Role for each application
      properties:
        accountcentral:
          type: string
          description: the role to assign for the accountcentral application.
        hub:
          type: string
          description: the role to assign for the ContactHub application
        mc:
          type: string
          description: the role to assign for the marketing cloud application
        cplan:
          type: string
          description: the role to assign for the ContactPlan application
        send:
          type: string
          description: the role to assign for the ContactSend application
        content:
          type: string
          description: the role to assign for the content provider application
        flow:
          type: string
          description: the role to assign for the ContactFlow application
        eddie:
          type: string
          description: the role to assign for the EmailDesigner application
        demo_client:
          type: string
          description: the role to assign for the jquery demo client
    NewsResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              timestamp:
                type: integer
              link:
                type: string
              title:
                type: string
              body:
                type: string
              categories:
                type: array
                items:
                  type: string
    NotificationResource:
      type: object
      properties:
        id:
          type: integer
        title:
          type: object
          properties:
            text:
              type: string
            code:
              type: string
              description: i18n code for internalization
        body:
          type: object
          properties:
            text:
              type: string
            code:
              type: string
              description: i18n code for internalization
        link:
          type: object
          properties:
            url:
              type: string
              description: url to an external resource
            text:
              type: string
            code:
              type: string
              description: i18n code for internalization
        application:
          type: string
        priority:
          type: string
          description: INFO, WARNING, ERROR
        timestamp:
          type: integer
        read:
          type: boolean
          description: if true the notification has already been read
        context:
          type: object
          properties:
            portfolio:
              type: string
            workspace:
              type: string
            node:
              type: string
    NotificationBodyRequest:
      type: object
      properties:
        destination:
          type: object
          properties:
            users:
              type: array
              items:
                type: integer
            workspace:
              type: string
              description: workspace to be notified, all users. Exclusive with workspace
        notification:
          type: object
          properties:
            title:
              type: object
              properties:
                text:
                  type: string
                code:
                  type: string
                  description: i18n code for internalization
            body:
              type: object
              properties:
                text:
                  type: string
                code:
                  type: string
                  description: i18n code for internalization
            link:
              type: object
              properties:
                url:
                  type: string
                  description: url to an external resource
                text:
                  type: string
                code:
                  type: string
                  description: i18n code for internalization
            application:
              type: string
            priority:
              type: string
              description: INFO, WARNING, ERROR
            timestamp:
              type: integer
            context:
              type: object
              properties:
                portfolio:
                  type: string
                workspace:
                  type: string
                node:
                  type: string
    SecurityEventsResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            type: object
            properties:
              idEvent:
                type: integer
              userPk:
                type: integer
              timestamp:
                type: integer
              ip:
                type: string
              country:
                type: string
              deviceName:
                type: string
              deviceType:
                type: string
              operatingSystem:
                type: string
              operatingSystemVersion:
                type: string
              browser:
                type: string
              browserVersion:
                type: string
              destinationApp:
                type: string
              eventType:
                type: string
      required:
        - elements
    ErrorResource:
      title: Error resource
      type: object
      properties:
        message:
          type: string
          description: Descriptive error message (English)
        logref:
          type: string
          description: Unique identifier that is reported in the application log
        data:
          type: object
          description: Specific error data
        errors:
          description: Sub-errors array
          type: array
          items:
            type: object
            properties:
              path:
                type: string
                description: JSON pointer to the invalid property
              message:
                type: string
                description: Descriptive error message (English)
              code:
                type: string
                description: Custom error code related to the path
              data:
                type: object
                description: Specific error data
            required:
              - path
              - message
      required:
        - message
        - logref
    PlatformSource:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        groupPk:
          type: integer
        groupName:
          type: string
        userDbId:
          type: integer
        userDbName:
          type: string
    FblResource:
      type: object
      properties:
        id:
          type: string
        esp:
          type: string
        recipientDomain:
          type: string
        signableHeaders:
          type: array
          items:
            type: string
        dkim:
          type: object
          properties:
            domain:
              type: string
            selector:
              type: string
            publicKey:
              type: string
            privateKey:
              type: string
    FblsResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            $ref: "#/components/schemas/FblResource"
    FblSource:
      type: object
      properties:
        esp:
          type: string
        recipientDomain:
          type: string
        signableHeaders:
          type: array
          items:
            type: string
        dkim:
          type: object
          properties:
            domain:
              type: string
            selector:
              type: string
            publicKey:
              type: string
            privateKey:
              type: string
    AcknowledgeResource:
      type: object
      properties:
        timestamp:
          type: integer
        result:
          type: string
        resultCode:
          type: string
    DkimData:
      type: object
      properties:
        domain:
          type: string
        selector:
          type: string
        publicKey:
          type: string
        privateKey:
          type: string
        active:
          type: boolean
      required:
        - domain
        - selector
        - publicKey
        - privateKey
        - active
    DkimsResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            $ref: "#/components/schemas/DkimResource"
    DkimResource:
      type: object
      properties:
        id:
          type: integer
        domain:
          type: string
        selector:
          type: string
        publicKey:
          type: string
        privateKey:
          type: string
          description: >
            The private key is returned only to DKIM role and is encrypted by
            AES symmetric algorithm.

            The field is null for CUSTOMER_CARE role
        alignment:
          type: string
          enum:
            - EXACT
            - RELAXED
            - NONE
            - NOT_AVAILABLE
          description: >
            How well this DKIM aligns with a specific domain. This value is only meaningful
            when the resource is the result of a call to the GET /customers/{customer}/dkim
            with a domain parameter passed, and it defaults to NOT_AVAILABLE in all of the
            other cases. Possible values are
             * EXACT this DKIM's domain matches exactly the required domain, e.g. the client
               requested a DKIM for the `example.org` domain and this DKIMS's domain is
               exactly `example.org`
             * RELAXED this DKIM's domain and the required domain have the same top private
               part, e.g. the client requested a DKIM for `example.org` and this DKIM's
               domain is `sub.example.og`
             * NONE the client requested a DKIM for a domain that does not match any of the
               customer's DKIMS, the returned DKIM is the customer's or platform's default
             * NOT_AVAILABLE the client did call an endpoint that does not accept a `domain`
               parameter
        default:
          type: boolean
    CustomerDkimsResource:
      type: object
      properties:
        page:
          $ref: "#/components/schemas/Page"
        elements:
          description: Elements contained in the page
          type: array
          items:
            $ref: "#/components/schemas/CustomerDkimResource"
    CustomerDkimResource:
      type: object
      properties:
        customerID:
          type: integer
        customerName:
          type: string
        domain:
          type: string
        selector:
          type: string
        default:
          type: boolean
        active:
          type: boolean
        versionDate:
          type: string
    PlatformDkimResource:
      type: object
      properties:
        domain:
          type: string
        selector:
          type: string
        publicKey:
          type: string
        privateKey:
          type: string
          description: >
            The private key is returned only to DKIM role and is encrypted by
            AES symmetric algorithm.

            The field is null for CUSTOMER_CARE role
      required:
        - domain
        - selector
        - publicKey
        - privateKey
    MessageSigningRequest:
      type: object
      properties:
        message:
          type: string
          description: >
            the email message to be signed (headers and all)
        data:
          $ref: "#/components/schemas/MessageSigningData"
        applyDkim:
          type: boolean
          description: >
            specify if dkim signing has to be applied (default true)
        applyFbl:
          type: boolean
          description: >
            specify if the fbl signing has to be applied (defualt true)
      required:
        - message
        - data
    MessageSigningData:
      type: object
      properties:
        deliveryId:
          type: integer
          description: the delivery this message belongs to
        newsletterId:
          type: integer
          description: the newsletter this message belongs to
        sender:
          type: string
          description: the RFC-822 email address of the message sender
        recipient:
          type: string
          description: the RFC-822 email address of the message recipient
      required:
        - deliveryId
        - newsletterId
        - sender
        - recipient
    SignedMessageResource:
      type: object
      properties:
        message:
          type: string
          description: the signed message
        dkim:
          $ref: "#/components/schemas/DkimResource"
        fbl:
          $ref: "#/components/schemas/FblResource"
    NewCustomerJobResource:
      type: object
      properties:
        groupPk:
          type: integer
          description: the customer id
        operation:
          type: string
          enum:
            - PREPARE_DEACTIVATION
            - DEACTIVATE
    JobCollectionResource:
      type: object
      properties:
        elements:
          type: array
          items:
            $ref: "#/components/schemas/CustomerJobResource"
        page:
          $ref: "#/components/schemas/Page"
    CustomerJobResource:
      type: object
      properties:
        id:
          type: string
          description: this job's unique id
        groupPk:
          type: integer
          description: the customer id the job refers to
        operation:
          type: string
          enum:
            - PREPARE_DEACTIVATION
            - DEACTIVATE
        status:
          type: string
          enum:
            - NEW
            - RUNNING
            - FINISHED
            - FAILED
        actions:
          type: array
          items:
            $ref: "#/components/schemas/JobActionResource"
    JobActionResource:
      type: object
      properties:
        "name":
          type: string
          description: the action's name
        status:
          type: string
          enum:
            - SUCCESS
            - FAILURE
        startedOn:
          type: string
          description: this action's start timestamp
        finishedOn:
          type: string
          description: this action's finish timestamp
    Page:
      type: object
      properties:
        size:
          type: integer
          description: Size of the page
        totalElements:
          type: integer
          description: Total elements in the collection
        totalUnfilteredElements:
          type: integer
          description: Total elements in the unfiltered collection
        totalPages:
          type: integer
          description: Total pages of the collection
        number:
          type: integer
          description: Number of the current page
