swagger: '2.0'
info:
  version: 0.9.2
  title: STARFACE Rest Api
  description: A Rest API for STARFACE
  termsOfService: 'http://www.starface.de/de/Unternehmen/agb.php'
  license:
    name: STARFACE proprietary license
    url: 'http://www.starface.de'
host: 'localhost:80'
basePath: /rest
schemes:
  - https
  - http
consumes:
  - application/json
produces:
  - application/json
paths:
  /login:
    get:
      operationId: getLogin
      summary: Get a template Login-Object filled with loginType and nonce
      description: "This endpoint returns a Template-Login-Object that provides the loginType and a nonce required by the Server. The Template-Login-Object can then be used to authorize a user by sending a POST-Request to this endpoint providing the user's secret. See the description of this endpoint's POST-Request for how to derive the secret from a user's loginId and password."
      responses:
        '200':
          description: A Template-Login-Object
          schema:
            $ref: '#/definitions/Login'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: login
      summary: Login to the Rest-Service and get an AuthToken
      description: >
        This endpoint is used to login to the STARFACE Rest-Service, by providing
        a Login-Object with a valid nonce and the corresponding user's secret.

        To obtain a valid nonce and the server's loginType refer to this
        endpoint's _GET-Method_.



        Based on the server's loginType configuration the secret can be
        calculated as follows:

        * LoginType.Internal: **SHA1(**_loginId_ **+** _nonce_ **+**
        _password_**)**

        * LoginType.ActiveDirectory: **BASE64(**_loginId_ **+** _nonce_ **+**
        _password_**)**



        If the Server can authentificate the user with the provided secret, an
        AuthToken is returned.

        The authToken-value must then be used in a HTTP header paramether named
        "authToken" in order to use this login for further requests.

        The token will be invalidated after 4 hours or after manual invalidation
        using this endpoint's _DELETE-Method_.



        Note that BASE64 is not a cryptographic hashing function.

        For security reasons it's recommended to use HTTPS over HTTP for the
        login.
      parameters:
        - name: login
          in: body
          description: "Login-Object with the user's secret."
          required: true
          schema:
            $ref: '#/definitions/Login'
      responses:
        '200':
          description: "Login was successful, returning the user's authToken"
          schema:
            $ref: '#/definitions/AuthToken'
        '401':
          description: Invalid login
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: logout
      summary: Invalidate the provided authToken.
      description: The authToken will be invalidated. User for the given authToken will be logged out.
      parameters:
        - name: authToken
          in: header
          description: The authToken to invalidate
          required: true
          type: string
      responses:
        '204':
          description: If a valid authToken was provided it has now been invalidated.
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /contacts/tags:
    get:
      operationId: getTagList
      summary: Retrieve a list of tags
      description: Retrieve a list of tags this user can access.
      parameters:
        - name: userId
          in: query
          description: >
            Perform an operation on behalf of another user. This requires
            administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: page
          in: query
          description: The page number for this request. This parameter is 0-indexed. This means that a value 0 returns the first page
          required: false
          type: integer
          format: int32
        - name: pagesize
          in: query
          description: The page size to use. Default is 20.
          required: false
          type: integer
          format: int32
        - name: sort
          in: query
          description: The fieldname to sort for.
          required: false
          type: string
        - name: sortdirection
          in: query
          description: "The sort direction. 'ASC' for ascending, 'DESC' for descending"
          required: false
          type: string
          enum:
            - ASC
            - DESC
      responses:
        '200':
          description: A list of available tags
          schema:
            type: array
            items:
              $ref: '#/definitions/Tag'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /contacts:
    get:
      operationId: getContactList
      summary: Retrieve a list of ContactSummary-Objects
      description: Retrieve a list of ContactSummary-Objects this user can access.
      parameters:
        - name: userId
          in: query
          description: >
            Perform an operation on behalf of another user. This requires
            administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: tags
          in: query
          description: Ids of tags to filter for
          required: false
          type: array
          items:
            type: string
          collectionFormat: csv
        - name: searchTerms
          in: query
          description: 'The string to search for in familyname, firstname, company or any configured number-field'
          required: false
          type: string
        - name: page
          in: query
          description: The page number for this request. This parameter is 0-indexed. This means that a value 0 returns the first page
          required: false
          type: integer
          format: int32
        - name: pagesize
          in: query
          description: The page size to use. Default is 20. The pagesize is currently limited to 40.
          required: false
          type: integer
          format: int32
        - name: sort
          in: query
          description: "The fieldname to sort for. For example 'familyname', 'firstname', 'company'"
          required: false
          type: string
        - name: sortdirection
          in: query
          description: 'The sort direction. ASC for ascending, DESC for descending'
          required: false
          type: string
          enum:
            - ASC
            - DESC
      responses:
        '200':
          description: 'The ContactList containing request metadata, the contacts scheme and contact summaries of matching contacts'
          schema:
            $ref: '#/definitions/ContactList'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: postContact
      summary: Create a new contact
      description: Create a new contact
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: contact
          in: body
          description: User object to add to the addressbook
          required: true
          schema:
            $ref: '#/definitions/Contact'
      responses:
        '201':
          description: The contact has successfully been created
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  '/contacts/{contactId}':
    get:
      operationId: getContact
      summary: Fetch a contact
      description: 'Fetch the contact with the given {contactId} from the addressbook'
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: contactId
          in: path
          description: Id of the contact that will be fetched
          required: true
          type: string
      responses:
        '200':
          description: 'OK. Returning the contact object with the given {contactId}'
          schema:
            $ref: '#/definitions/Contact'
        '404':
          description: 'Not Found. A contact with the given {contactId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: putContact
      summary: Update a contact
      description: 'Updates the contact with the given {contactId} from the provided payload'
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: contactId
          in: path
          description: Id of the contact to update
          required: true
          type: string
        - name: contact
          in: body
          description: Contact-Object with updated values that should be applied
          required: true
          schema:
            $ref: '#/definitions/Contact'
      responses:
        '204':
          description: 'OK. The Contact with the given {contactId} has successfully been updated'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: deleteContact
      summary: Delete a contact
      description: 'Delete the contact with the given {contactId} from the addressbook'
      parameters:
        - name: contactId
          in: path
          description: Id of the contact
          required: true
          type: string
      responses:
        '204':
          description: 'Contact with the given {contactId} has been deleted successfully'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /contacts/scheme:
    get:
      operationId: getScheme
      summary: Get the configured ContactsScheme
      description: Get the configured ContactsScheme
      parameters:
        - name: lang
          in: query
          description: Language identifiers as specified by RFC 3066 for i18nDisplayName
          required: false
          type: string
      responses:
        '200':
          description: OK. Returning the ContactsScheme
          schema:
            $ref: '#/definitions/ContactsScheme'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /fmcPhones:
    get:
      operationId: getFmcPhones
      summary: Retrieve a list of FmcPhones
      description: Retrieve a list of STARFACE IFMC phones for the current user.
      parameters:
        - name: userId
          in: query
          description: >
            Perform an operation on behalf of another user. This requires
            administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
      responses:
        200:
          description: A list of available FmcPhones
          schema:
            type: array
            items:
              $ref: '#/definitions/FmcPhone'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: postFmcPhone
      summary: Create a new FmcPhone
      description: Create a new FmcPhone
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: fmcPhone
          in: body
          description: FmcPhone object to add
          required: true
          schema:
            $ref: '#/definitions/FmcPhone'
      responses:
        '201':
          description: The FmcPhone has successfully been created
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
      
  /fmcPhones/{fmcId}:
    get:
      operationId: getFmcPhone
      summary: Fetch a FmcPhone
      description: Fetch the FmcPhone with the given {fmcId}
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: fmcId
          in: path
          description: Id of the FmcPhone that will be fetched
          required: true
          type: string
      responses:
        200:
          description: 'OK. Returning the FmcPhone object with the given {fmcId}'
          schema:
            $ref: '#/definitions/FmcPhone'
        404:
          description: 'Not Found. A FmcPhone with the given {fmcId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: putFmcPhone
      summary: Update a FmcPhone
      description: Update the FmcPhone with the given {fmcId}
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: fmcId
          in: path
          description: Id of the FmcPhone that will be updated
          required: true
          type: string
        - name: redirection
          in: body
          description: FmcPhone-Object with updated values that should be applied
          required: true
          schema:
            $ref: '#/definitions/FmcPhone'
      responses:
        204:
          description: 'The FmcPhone with the given {fmcId} has successfully been updated'
          schema:
            $ref: '#/definitions/FmcPhone'
        404:
          description: 'Not Found. A FmcPhone with the given {fmcId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'      
    delete:
      operationId: deleteFmcPhone
      summary: Delete a FmcPhone
      description: Delete the FmcPhone with the given {fmcId}
      parameters:
        - name: userId
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: fmcId
          in: path
          description: Id of the FmcPhone that will be deleted
          required: true
          type: string
      responses:
        204:
          description: 'The FmcPhone with the given {fmcId} has successfully been deleted'
        404:
          description: 'Not Found. A FmcPhone with the given {fmcId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /functionkeysets:
    get:
      operationId: getFunctionKeySets
      summary: Retrieve a list of FunctionKeySets
      description: Retrieve a list of FunctionKeySets for the current user.
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
      responses:
        '200':
          description: 'A list of available FunctionKeySets'
          schema:
            type: array
            items:
              $ref: '#/definitions/FunctionKeySet'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /functionkeysets/{fkSetId}:
    get:
      operationId: getFunctionKeySet
      description: Fetch the FunctionKeySet with the given {fkSetId}
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
      responses:
        '200':
          description: 'Returning the FunctionKeySet object with the given {fkSetId}'
          schema:
            $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: updateFunctionKeySet
      description: Update the FunctionKeySet with the given {fkSetId}. This operation can be used to reorder the FunctionKeys contained in this set.
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
        - name: functionKeySet
          in: body
          description: 'The updated FunctionKeySet to reorder FunctionKeys'
          required: true
          schema:
            $ref: '#/definitions/FunctionKeySet'
      responses:
        '204':
          description: 'The FunctionKeySet with the given {fkSetId} has successfully been updated'
          schema:
            $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /functionkeysets/{fkSetId}/keys/:
    get:
      operationId: getFunctionKeys
      description: Retrieve the list of FunctionKeys contained in the given FunctionKeySet.
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
      responses:
        '200':
          description: 'The list of contained FunctionKeys'
          schema:
            type: array
            items:
              $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      description: Creates a new FunctionKey and appends it to the end of the FunctionKeySet
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
        - name: functionKey
          in: body
          description: The new FunctionKey to create
          required: true
          schema:
            $ref: '#/definitions/FunctionKey'
      responses:
        '201':
          description: The FunctionKey has successfully been created
          schema:
            $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
      operationId: createFunctionKey
  /functionkeysets/{fkSetId}/keys/{keyId}:
    get:
      operationId: getFunctionKey
      description: Fetch the FunctionKey with the given {keyId}
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
        - name: keyId
          in: path
          description: The Id of the FunctionKey
          required: true
          type: string
      responses:
        '200':
          description: Returning the FunctionKey object with the given {keyId}
          schema:
            $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: updateFunctionKey
      description: Update the FunctionKey with the given {keyId}
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
        - name: keyId
          in: path
          description: The Id of the FunctionKey
          required: true
          type: string
        - name: functionKey
          in: body
          description: The updated FunctionKey
          required: true
          schema:
            $ref: '#/definitions/FunctionKey'
      responses:
        '204':
          description: 'The FunctionKey with the given {keyId} has successfully been updated'
          schema:
            $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: deleteFunctionKey
      description: Delete the FunctionKey with the given {keyId}
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
        - name: keyId
          in: path
          description: The Id of the FunctionKey
          required: true
          type: string
      responses:
        '204':
          description: 'The FunctionKey with the given {keyId} has successfully been deleted'
          schema:
            $ref: '#/definitions/FunctionKey'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /functionkeysets/{fkSetId}/keys/{keyId}/press:
    post:
      operationId: pressFunctionKey
      summary: Performs the action assigned to the FunctionKey.
      description: Performs the action assigned to the FunctionKey. The action that is performed is defined by the functionKeyType.
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
        - name: fkSetId
          in: path
          description: The Id of the FunctionKeySet
          required: true
          type: string
        - name: keyId
          in: path
          description: The Id of the FunctionKey
          required: true
          type: string
        - name: params
          in: query
          description: An array of parameters used to perform the action. These parameters are defined by the functionKeyType.
          type: array
          items:
            type: string
            
      responses:
        '204':
          description: No Content, FunctionKey has been pressed.
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'            
  /callservices:
    get:
      operationId: getCalServices
      summary: Retrive a list of all available call services
      parameters:
        - name: type
          description: filter for a call service type. If none or an invalid type is provided the type filter will default to FOR_USER_ACCOUNTS
          in: query
          required: false
          type: string
          enum:
            - NONE
            - FOR_GROUPS
            - FOR_USER_ACCOUNTS
            - FOR_EXTENSION
            - FOR_BLF
      responses:
        200:
          description: A list of available CallServices
          schema:
            type: array
            items:
              $ref: '#/definitions/CallService'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'  
  /callservices/{serviceId}:
    get:
      operationId: getCallService
      summary: Fetch a CallService
      description: Fetch the CallService with the given {serviceId}
      parameters:
        - name: serviceId
          in: path
          description: Id of the CallService that will be fetched
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'OK. Returning the CallService object with the given {serviceId}'
          schema:
            $ref: '#/definitions/CallService'
        404:
          description: 'Not Found. A CallService with the given {serviceId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'        
  /phonenumbers:
    get:
      operationId: getPhoneNumbers
      summary: Retrive a list of all configured PhoneNumbers
      parameters:
        - name: type
          in: query
          description: filter for the type of the PhoneNumber
          required: false
          type: string
          enum:
            - INTERNAL
            - EXTERNAL
        - name: assigned
          description: filter for only ssssigned or unassigned PhoneNumbers
          in: query
          required: false
          type: boolean        
      responses:
        200:
          description: A list of available PhoneNumbers
          schema:
            type: array
            items:
              $ref: '#/definitions/PhoneNumber'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /phonenumbers/{phoneNumberId}:
    get:
      operationId: getPhoneNumber
      summary: Fetch a PhoneNumber
      description: Fetch the PhoneNumber with the given {phoneNumberId}
      parameters:
        - name: phoneNumberId
          in: path
          description: Id of the PhoneNumber that will be fetched
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'OK. Returning the PhoneNumber object with the given {phoneNumberId}'
          schema:
            $ref: '#/definitions/PhoneNumber'
        404:
          description: 'Not Found. A PhoneNumber with the given {phoneNumberId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/phonenumberconfig:
    get:
      operationId: getPhoneNumberConfig
      summary: Fetch the PhoneNumberConfig
      description: Fetch the PhoneNumberConfig of the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning the PhoneNumberConfig of the User with the given {userId}'
          schema:
            $ref: '#/definitions/PhoneNumberConfig'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/phonenumberconfig/phonenumbers/:
    get:
      operationId: listPhoneNumberAssignment
      summary: Fetches a list of assigned phone numbers
      description:  Fetches a list of assigned phone numbers for the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning a list of assigned phone numbers for the User with the given {userId}'
          schema:
            type: array
            items:
              $ref: '#/definitions/PhoneNumberAssignment'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/phonenumberconfig/phonenumbers/{phoneNumberId}:
    get:
      operationId: getPhoneNumberAssignment
      summary: Fetches the PhoneNumberAssignment
      description: Fetches the PhoneNumberAssignment for the corresponding {phoneNumberId} of the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
        - name: phoneNumberId
          in: path
          description: Id of the PhoneNumber thats is assigned to the User with the given {userId}
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning the PhoneNumberAssignment for the corresponding {phoneNumberId} of the User with the given {userId}'
          schema:
            $ref: '#/definitions/PhoneNumberAssignment'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'           
  /redirects:
    get:
      operationId: getRedirects
      summary: Retrieve a list of redirects
      description: Retrieve a list of redirects for the current user.
      parameters:
        - name: actOnBehalfOf
          in: query
          description: >
            Perform an operation on behalf of another user. This requires
            administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
      responses:
        200:
          description: A list of available redirects
          schema:
            type: array
            items:
              $ref: '#/definitions/Redirection'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /redirects/{redirectId}:
    get:
      operationId: getRedirect
      summary: Fetch a Redirection
      description: Fetch the Redirection with the given {redirectId}
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: redirectId
          in: path
          description: Id of the Redirection that will be fetched
          required: true
          type: string
      responses:
        200:
          description: 'OK. Returning the Redirection object with the given {redirectId}'
          schema:
            $ref: '#/definitions/Redirection'
        404:
          description: 'Not Found. A Redirection with the given {redirectId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: putRedirect
      summary: Update a Redirection
      description: Update the Redirection with the given {redirectId}
      parameters:
        - name: actOnBehalfOf
          in: query
          description: Perform an operation on behalf of another user. This requires administrative privileges.
          required: false
          type: string
          pattern: '/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/'
        - name: redirectId
          in: path
          description: Id of the Redirection that will be updated
          required: true
          type: string
        - name: redirection
          in: body
          description: Redirection-Object with updated values that should be applied
          required: true
          schema:
            $ref: '#/definitions/Redirection'
      responses:
        204:
          description: 'OK. The Redirection with the given {redirectId} has successfully been updated'
          schema:
            $ref: '#/definitions/Redirection'
        404:
          description: 'Not Found. A Redirection with the given {redirectId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'                  
  /users:
    get:
      operationId: getUsers
      summary: Retrieve a list of users
      description: Retrieve a list of STARFACE users the current user can access.
      parameters:
        - name: searchTerm
          in: query
          description: The searchTerm to query users.
          required: false
          type: string
      responses:
        200:
          description: OK. A list of accessable User
          schema:
            type: array
            items:
              $ref: '#/definitions/User'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: postUser
      summary: Create a new user
      description: Create a new STARFACE user
      parameters:
        - name: user
          in: body
          description: User object to add
          required: true
          schema:
            $ref: '#/definitions/User'
      responses:
        '201':
          description: Created.  User has successfully been created
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/me:
    get:
     description: endpoint alias for /users/{userId} of the user that is corrently logged in
     responses:
      '200':
        description: OK. Returning the User object of the user that is corrently logged in
        schema:
          $ref: '#/definitions/User'
      default:
        description: Unexpected error
        schema:
          $ref: '#/definitions/Error'
  /users/{userId}:
    get:
      operationId: getUser
      summary: Fetch a user
      description: Fetch the STARFACE user with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User that will be fetched
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'OK. Returning the User object with the given {userId}'
          schema:
            $ref: '#/definitions/User'
        404:
          description: 'Not Found. A User with the given {userId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: putUser
      summary: Update a user
      description: Update the STARFACE user with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User that will be updated
          required: true
          type: integer
          format: int32
        - name: user
          in: body
          description: User-Object with updated values that should be applied
          required: true
          schema:
            $ref: '#/definitions/User'
      responses:
        204:
          description: 'No Content. The User with the given {userId} has successfully been updated'
          schema:
            $ref: '#/definitions/User'
        404:
          description: 'Not Found. An User with the given {userId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: deleteUser
      summary: Delete a user
      description: Delete the STARFACE user with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User that will be deleted
          required: true
          type: integer
          format: int32
      responses:
        204:
          description: 'No Content. The User with the given {userId} has successfully been deleted'
        404:
          description: 'Not Found. An User with the given {userId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/avatar:
    get:
      operationId: getAvatar
      summary: Fetch the Avatar
      description: Fetch the Avatar of the user with the given {userId}
      produces:
        - image/jpeg
      parameters:
        - name: userId
          in: path
          description: Id of the User thats avatar will be fetched
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'OK. Returning the Avatar of the User with the given {userId}'
        404:
          description: 'Not Found. An User with the given {userId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: setAvatar
      summary: Set the Avatar
      description: Set the Avatar of the user with the given {userId}
      consumes:
        - multipart/form-data
      parameters:
        - name: avatar
          in: formData
          description: The new avatar of the user
          required: true
          type: file
        - name: userId
          in: path
          description: Id of the User thats avatar will be updated
          required: true
          type: integer
          format: int32
      responses:
        204:
          description: 'No Content. The Avatar of the User with the given {userId} has successfully been set'
        404:
          description: 'Not Found. An User with the given {userId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: deleteAvatar
      summary: Delete the Avatar
      description: Delete the Avatar of the user with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User thats avatar will be updated
          required: true
          type: integer
          format: int32
      responses:
        204:
          description: 'No Content. The Avatar of the User with the given {userId} has successfully been deleted'
        404:
          description: 'Not Found. An User with the given {userId} was not found'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'

  /users/{userId}/phoneconfig:
    get:
      operationId: getPhoneConfig
      summary: Fetch the PhoneConfig
      description: Fetch the PhoneConfig of the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning the PhoneConfig of the User with the given {userId}'
          schema:
            $ref: '#/definitions/PhoneConfig'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: putPhoneConfig
      summary: Update the PhoneConfig
      description: Update the PhoneConfig of the User with the given {userId}
      parameters:
        - name: phoneConfig
          in: body
          description: PhoneConfig-Object with updated values that should be applied
          required: true
          schema:
            $ref: '#/definitions/PhoneConfig'
        - name: userId
          in: path
          description: Id of the User thats phoneConfig will be updated
          required: true
          type: integer
          format: int32
      responses:
        204:
          description: 'No Content. The PhoneConfig has been successfully been updated'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/phoneconfig/phones:
    get:
      operationId: listAssignedPhones
      summary: Fetches a list of assigned phones
      description:  Fetches a list of assigned phones for the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning a list of assigned phones for the User with the given {userId}'
          schema:
            type: array
            items:
              $ref: '#/definitions/PhoneAssignment'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    post:
      operationId: assignPhone
      summary: Assignes a phone to the User
      description: Assignes a phone to the User with the given {userId}
      parameters:
        - name: phoneAssignment
          in: body
          description: PhoneAssignment-Object to assign the phone to the User with the given {userId}
          required: true
          schema:
            $ref: '#/definitions/PhoneAssignment'
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
      responses:
        201:
          description: 'Created. The phone has successfully been assigned to the User with the given {userId}'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/phoneconfig/phones/{phoneId}:
    get:
      operationId: getPhoneAssignment
      summary: Fetches the PhoneAssignment
      description: Fetches the PhoneAssignment for the corresponding {phoneId} of the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
        - name: phoneId
          in: path
          description: Id of the Phone thats is assigned to the User with the given {userId}
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning the PhoneAssignment for the corresponding {phoneId} of the User with the given {userId}'
          schema:
            $ref: '#/definitions/PhoneAssignment'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    delete:
      operationId: deletePhoneAssignment
      summary: Deletes the PhoneAssignment
      description: Deletes the PhoneAssignment from the User with the given {userId}
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
        - name: phoneId
          in: path
          description: Id of the Phone that gets unassigned from the User with the given {userId}
          required: true
          type: integer
          format: int32
      responses:
        204:
          description: 'No Content. The phone with the given {phoneId} has successfully been unassigned from the User'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
  /users/{userId}/phoneconfig/phones/{phoneId}/numbers:
    get:
      operationId: getNumbersForAssignedPhone
      summary: Fetches a list of NumberForPhoneAssignment
      description: Fetches a list of NumberForPhoneAssignment of the User with the given {userId} and the Phone with the given {phoneId}.
      parameters:
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
        - name: phoneId
          in: path
          description: Id of the Phone thats number assignments are fetched
          required: true
          type: integer
          format: int32
      responses:
        200:
          description: 'Ok. Returning a list of assigned numbers to the assigned phone with the given {phoneId} for the User with the given {userId}'
          schema:
            type: array
            items:
              $ref: '#/definitions/NumberForPhoneAssignment'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'
    put:
      operationId: updateNumbersForAssignedPhones
      summary: Updates the list of NumberForPhoneAssignment
      description: Updates the list of NumberForPhoneAssignment of the User with the given {userId} and the Phone with the given {phoneId}. Only the active-flag can be changed. Elements in the list cannot be added or removed.
      parameters:
        - name: numberForPhoneAssignments
          in: body
          description: List of NumberForPhoneAssignment-Objects to update assigned numbers for the Phone with the given {phoneId} of the User with the given {userId}
          required: true
          schema:
            type: array
            items:
              $ref: '#/definitions/NumberForPhoneAssignment'
        - name: userId
          in: path
          description: Id of the User
          required: true
          type: integer
          format: int32
        - name: phoneId
          in: path
          description: Id of the Phone thats number assignments are updated
          required: true
          type: integer
          format: int32
      responses:
        204:
          description: 'No Content. The list of assigned numbers to the assigned phone with the given {phoneId} has been updated successfully.'
        default:
          description: Unexpected error
          schema:
            $ref: '#/definitions/Error'           
            
            
            
            
            
            
definitions:
  Tag:
    description: A representation of a addressbook folder/directory
    required:
      - name
    properties:
      id:
        description: The Id of the folder
        type: string
      name:
        description: The name/path of the folder.
        type: string
      alias:
        description: The alias for the folder that is presented to the enduser
        type: string
      owner:
        type: string
  Attribute:
    description: |
      Key for the internationalization
    required:
      - displayKey
      - name
    properties:
      displayKey:
        description: Enum key of the Attribute
        type: string
        enum:
          - NAME
          - SURNAME
          - SALUTATION
          - TITLE
          - EMAIL
          - COUNTRY
          - CITY
          - STATE
          - POSTAL_CODE
          - STREET
          - URL
          - COMPANY
          - MESSENGER
          - BIRTHDAY
          - NOTE
          - JOB_TITLE
          - PHONE_NUMBER
          - PRIVATE_PHONE_NUMBER
          - OFFICE_PHONE_NUMBER
          - MOBILE_PHONE_NUMBER
          - FAX_NUMBER
          - DESCRIPTION
          - USER_DEFINED
      name:
        type: string
      value:
        type: string
      additionalValues:
        description: |
          Additional values for this Attribute, for example SHORTDIAL
        type: object
        additionalProperties:
          type: string
      i18nDisplayName:
        description: >
          A string representation of this displayKey in its respective user
          language
        type: string
  ContactsScheme:
    description: The schema for the addressbook that is configured at the server. Describing the structure of Contact-Objects and the values of ContactSummary-Objects.
    properties:
      summaryBlock:
        description: A Block describing the structure of the summaryValue-Field of a ContactSummary-Object
        $ref: '#/definitions/Block'
      phoneNumbersBlock:
        description: A Block describing the structure of the phoneNumberValues-Field of a ContactSummary-Object
        $ref: '#/definitions/Block'
      detailBlocks:
        description: A Block describing the structure of values of a Contact-Object
        type: array
        items:
          $ref: '#/definitions/Block'
  Contact:
    description: Contact detail information
    properties:
      id:
        description: the Id of a contact
        type: string
      jabberId:
        description: "if this contact is representing a user then the user's jabberId, otherwise empty"
        type: string
      accountId:
        description: "if this contact is representing a user then the user's accountId, otherwise empty"
        type: integer
        format: int32
      primaryExternalNumber:
        description: "if this contact is representing a user then the user's primary external phone number, otherwise empty"
        type: string
      primaryInternalNumber:
        description: "if this contact is representing a user then the user's primary internal phone number, otherwise empty"
        type: string
      editable:
        description: flag whether this contact can be edited
        type: boolean
      tags:
        description: List of Tags this contact can be found under
        type: array
        items:
          $ref: '#/definitions/Tag'
      blocks:
        description: List of Blocks holding the detail information
        type: array
        items:
          $ref: '#/definitions/Block'
  Block:
    description: Blocks contain a list of attributes for a contact
    properties:
      name:
        description: The name of the block
        type: string
      resourceKey:
        description: The resourceKey of the block
        type: string
      attributes:
        description: A List of attributes
        type: array
        items:
          $ref: '#/definitions/Attribute'
  ContactList:
    description: bandwidth-saving JSON-Object for a list of contacts. Contains schema information that can be used to interpret the summary and phoneNumber values of a contact and the ContactSummary-Objects.
    properties:
      metadata:
        $ref: '#/definitions/RequestMetadata'
      summaryBlockSchema:
        $ref: '#/definitions/Block'
      phoneNumbersBlockSchema:
        $ref: '#/definitions/Block'
      contacts:
        description: List of ContactSummary
        type: array
        items:
          $ref: '#/definitions/ContactSummary'
  ContactSummary:
    description: Summary values from contacts without schema information. For information on what fields these values correspond get the ContactsScheme.
    required:
      - id
    properties:
      id:
        description: The Id of a contact
        type: string
      summaryValues:
        type: array
        items:
          type: string
      phoneNumberValues:
        type: array
        items:
          type: string
      additionalValues:
        description: >
          Additional values for the ContactSummary, for example INTERNAL_NUMBER,
          EXTERNAL_NUMBER, AVATAR, USER_ACCOUNT_ID
        type: object
        additionalProperties:
          type: string
  RequestMetadata:
    description: Metadata for a request that returns data for multiple entities. This includes pageing and sorting properties.
    properties:
      page:
        description: The 0-indexed page number.
        type: integer
        format: int32
      pagesize:
        description: The pagesize used for the request. Indicates the row count of data that has just been returned.
        type: integer
        format: int32
      sort:
        description: The fieldname that has been used sort the entities.
        type: string
      sortdirection:
        description: The sort direction that has been used. Either ASC for ascending or DESC for descending.
        type: string
        enum:
          - ASC
          - DESC
      totalPages:
        description: The total number of pages that are available.
        type: integer
        format: int32
  Login:
    description: >
      A JSON-Object used for the authentification process.

      The Server can be asked for a Template-Login-Object holding a valid nonce
      and the loginType but no secret.

      The Template-Login-Object can then be used to login by filling in the
      secret of a user.
    required:
      - nonce
    properties:
      loginType:
        description: The loginType that is configured at the server. Determines the function used to obtain the user's secret.
        type: string
        enum:
          - Internal
          - ActiveDirectory
      nonce:
        description: A string provided by the server that can be used to login only once. Only server generated nonces are valid.
        type: string
      secret:
        description: The secret of a user that is valid for the provided nonce.
        type: string
  AuthToken:
    description: A JSON-Object holding an authToken used for authentification
    required:
      - token
    properties:
      token:
        description: The authToken value to be used in the authToken-Header for further requests
        type: string
  Error:
    description: See the _HTTP/1.1 Status Code_ for general information on what type of error occured. The code can be used to further analyze a problem.
    required:
      - code
      - message
    properties:
      code:
        type: string
      message:
        type: string
  FmcPhone:
    description: A representation of an FmcPhone
    properties:
      id:
        description: the Id of the FmcPhone
        type: string
      telephoneId:
        description: the Id of the corresponding telephone
        type: string
      number:
        description: the number that will be called
        type: string
      delay:
        description: defines the delay before the FmcPhone is called
        type: integer
      active:
        description: whether this FmcPhone is activated or deactivated
        type: boolean
      confirm:
        description: whether the user must confirm a call with the FmcPhone
        type: boolean
      fmcSchedule:
        description: List of TimeFrames that define when this FmcPhone is called
        type: array
        items:
          $ref: '#/definitions/TimeFrame'
    required:
      - id
      - number
      - delay
      - confirm
  TimeFrame:
    description: A TimeFrame defines a TimeRange in 24 hour format between 00:00 and 24:00 for each day of week
    properties:
      timeBegin:
        description: the time defining the beginning of the TimeRange (inclusive)
        type: string
      timeEnd:
        description: the time defining the end of the TimeRange (inclusive)
        type: string
      monday:
        type: boolean
      tuesday:
        type: boolean
      wednesday:
        type: boolean
      thursday:
        type: boolean
      friday:
        type: boolean
      saturday:
        type: boolean
      sunday:
        type: boolean
  FunctionKeySet:
    description: An ordered set of FunctionKeys that can be used for changing the order of FunctionKeys
    properties:
      id:
        description: the Id of the FunctionKeySet
        type: string
      name:
        description: the name of the FunctionKeySet
        type: string
      keyOrder:
        description: List of Ids of contained FunctionKeys. The ordering of this List defines the positioning of the FunctionKeys.
        type: array
        items:
          type: string
    required:
      - id
      - name
      - keyOrder
  FunctionKey:
    description: A representation of a FunctionKey
    type: object
    properties:
      functionKeyType:
        description: The type of the FunctionKey determining the concrete FunctionKey implementation.
        type: string
        enum:
          - SIGNALNUMBER
          - SEPARATOR
          - QUICKDIAL
          - PHONEGENERICURL
          - PHONEDTMF
          - PHONECONTACTSEARCH
          - PHONECONTACTLIST
          - PHONECONTACT
          - PHONECALLLISTOUTGOING
          - PHONECALLLISTMISSED
          - PHONECALLLISTINCOMING
          - PARKANDORBIT
          - MODULEACTIVATION
          - GROUPLOGIN
          - FORWARDNUMBERUNCONDITIONAL
          - FORWARDCALLUNCONDITIONAL
          - FORWARDCALLNORESPONSE
          - FORWARDCALLBUSY
          - DONOTDISTURB
          - COMPLETIONOFCALLSTOBUSYSUBSCRIBER
          - BUSYLAMPFIELD
      id:
        description: the Id of the FunctionKey
        type: string
      name:
        description: the display name of the FunctionKey
        type: string
      accountId:
        description: the accountId of the FunctionKey
        type: string
      state:
        description: state of the function key with one of the constants of INVALID, UNAVAILABLE, INACTIVE, FLASHY, ACTIVE, QUEUE_PAUSE
        type: string
        enum:
          - INVALID
          - UNAVAILABLE
          - INACTIVE
          - FLASHY
          - ACTIVE
          - QUEUE_PAUSE
      position:
        description: the position of the FunctionKey wthin its FunctionKeySet
        type: integer
        format: int32
      systemkey:
        description: 'Flag for Systemkey: 0 = userkey, 1 = systemkey'
        type: boolean
      subscription:
        description: The subscription. In case of functionKeyType BUSYLAMPFIELD the subscription is build using 'a' + the target accountId
        type: string
      addressBookFolderName:
        type: string
      addressBookFolder:
        type: string
      targetNumber:
        type: string  
      url:
        type: string  
      dtmf:
        type: string  
      imageHash:
        type: string
      userInfo:
        $ref: '#/definitions/FunctionKeyUserInfo'
      userState:
        $ref: '#/definitions/FunctionKeyUserState'
    required:
      - functionKeyType
      - id
      - name
      - accountId
      
  FunctionKeyUserInfo:
    description: Defines additional user information that are provided for FunctionKeys of type BUSYLAMPFIELD
    properties:
      chatId:
        type: string
      email:
        type: string
      phoneNumber:
        type: string
      phonenumber2:
        type: string
      mobilePhoneNumber:
        type: string
      homePhoneNumber:
        type: string
      internalPhoneNumber:
        type: string
      fax:
        type: string
  FunctionKeyUserState:
    description: Defines additional user state information that are provided for FunctionKeys of type BUSYLAMPFIELD
    properties:
      doNotDisturbSetting:
        type: boolean
      redirectAlwaysActive:
        type: boolean
      chatPresence:
        type: string
        enum:
          - UNAVAILABLE
          - AVAILABLE
          - FREE_FOR_CHAT
          - AWAY
          - EXTENDED_AWAY
          - DO_NOT_DISTURB
      chatPresenceMessage:
        type: string
      avatarHash:
        type: string
      state:
        type: string
        enum:
          - UNAVAILABLE
          - AVAILABLE
          - RINGING
          - ACTIVE
          - QUEUE_PAUSE 
  PhoneNumber:
    description: A representation of a phone number
    properties:
      id:
        description: the Id of the phone number
        type: integer
        format: int32
      type:
        description: the type of the phone number
        type: string
        enum:
          - INVALID
          - INTERNAL
          - EXTERNAL
          - RESERVED
          - NT
          - DISPLAY
          - FXO
      number:
        description: the number itself (extention)
        type: string
      name:
        description: the name of the phone number
        type: string
      numberBlockId:
        description: the id of the corresponding NumberBlock
        type: integer
        format: int32
      exitCode:
        description: the exit code of the phone number
        type: string
      localPrefix:
        description: the local prefix of the phone number
        type: string
      nationalPrefix:
        description: the national prefix of the phone number
        type: string
      assignedUserAccountId:
        description: the id of the user account this phone number is assigned to or null if it is not assigned to an account
        type: integer
        format: int32
      assignedGroupAccountId:
        description: the id of the group account this phone number is assigned to or null if it is not assigned to an account
        type: integer
        format: int32
      assignedModuleInstanceId:
        description: the id of the module instance this phone number is assigned to or null if it is not assigned to a module
        type: string
      assignedModuleEntryPointId:
        description: the id of the module entry point this phone number is assigned to or null if it is not assigned to a module
        type: string
  PhoneNumberConfig:
    description: Representation of phone number config options for a User
    properties:
      primaryInternalNumberId:
        description: the Id of the PhoneNumber that is used as the primary internal phone number
        type: integer
        format: int32
      primaryExternalNumberId:
        description: the Id of the PhoneNumber that is used as the primary external phone number
        type: integer
        format: int32
    required:
      - primaryInternalNumberId
      - primaryExternalNumberId
  PhoneNumberAssignment:
    description: Representation of an assignment from a PhoneNumber to a User
    properties:
      accountId:
        description: the Id of the User
        type: integer
        format: int32
      phoneNumberId:
        description: the Id of the PhoneNumber that is assigned to the User
        type: integer
        format: int32
      number:
        description: the number of the PhoneNumber that is assigned to the User
        type: string
      exitCode:
        description: the exit code of the PhoneNumber that is assigned to the User
        type: string
      localPrefix:
        description: the local prefix of the PhoneNumber that is assigned to the User
        type: string
      nationalPrefix:
        description: the national prefix of the PhoneNumber that is assigned to the User
        type: string
      serviceId:
        description: the Id of the call service rule that is used for this phone number.
        type: integer
        format: int32
  CallService:
    description: Representation of a call service
    properties:
      serviceId:
        description: the Id of the CallService
        type: integer
        format: int32
      serviceName:
        description: the name of the CallService
        type: string
      label:
        description: the label of the CallService that is used in the UI
        type: string
  Redirection:
    description: A representation of a Redirection
    properties:
      id:
        description: The Id of the Redirection
        type: string
      phoneNumber:
        description: The phoneNumber that will be handled by this Redirection 
        type: string
      groupNumber:
        description: True if the phoneNumber of this Redirection is assigned to a group, false otherwise
        type: boolean
      enabled:
        description: Whether this Redirection is enabled or disabled
        type: boolean
      redirectTrigger:
       # description: The redirectTrigger defines for which calls this Redirection will be triggered
        $ref: '#/definitions/RedirectTrigger'
      redirectDestination:
       # description: The RedirectDestination defines to which destination a call will be redirected
        $ref: '#/definitions/RedirectDestination'
      lastMailboxDestination:
        $ref: '#/definitions/RedirectMailboxDestination'
      lastPhoneNumberDestination:
        $ref: '#/definitions/RedirectPhoneNumberDestination'
  RedirectTrigger:
    description: Abstract base for always, busy and timeout trigger
    discriminator: redirectTriggerType
    type: object
    required:
      - redirectTriggerType
    properties:
      redirectTriggerType:
        description: The type of the RedirectTrigger determining the concrete RedirectTrigger implementation
        type: string
        enum:
          - ALWAYS
          - BUSY
          - TIMEOUT
  RedirectAlwaysTrigger:
    description: This RedirectTrigger will trigger always
    allOf:
      - $ref: '#/definitions/RedirectTrigger'
  RedirectBusyTrigger:
    description: This RedirectTrigger will trigger if the user is currently busy
    allOf:
      - $ref: '#/definitions/RedirectTrigger'
  RedirectTimeoutTrigger:
    description: This RedirectTrigger will trigger after the specified timeout if the call is not answered
    allOf:
      - $ref: '#/definitions/RedirectTrigger'
      - required:
        - timeout
        properties:
          timeout:
            type: integer
            format: int32
  RedirectDestination:
    description: Abstract base for mailbox and phonenumber destination
    discriminator: redirectDestinationType
    required:
      - redirectDestinationType
    properties:
      redirectDestinationType:
        description: The type of the RedirectDestination determining the concrete RedirectDestination implementation
        type: string
        enum:
          - MAILBOX
          - PHONENUMBER
  RedirectMailboxDestination:
    description: This RedirectDestination will redirect to the mailbox with the given mailboxId
    allOf:
      - $ref: '#/definitions/RedirectDestination'
      - type: object
      - required:
        - mailboxId
        properties:
          mailboxId:
            type: string
  RedirectPhoneNumberDestination:
    description: This RedirectDestination will redirect to a phoneNumber
    allOf:
      - $ref: '#/definitions/RedirectDestination'
      - required:
        - phoneNumber
        properties:
          phoneNumber:
            type: string
  User:
    description: A representation of a STARFACE user
    properties:
      id:
        description: the Id of the user
        type: integer
        format: int32
      personId:
        description: the Id of the corresponding person contact object
        type: string
      language:
        description: the language of a user
        type: string
      email:
        description: the email address of the user
        type: string
      password:
        description: defines a new password when a user is created or updated. This field will be empty when a user is fetched.
        type: string
      login:
        description: the login number for this user. The login number will be used as Jabber Id
        type: string
      namespace:
        description: the namespace defining the location of an user account
        type: string
      familyName:
        description: the family name of the user
        type: string
      firstName:
        description: the name of the user
        type: string
      missedCallReport:
        description: whether the user recieves a report on missed calls
        type: boolean
      faxCallerId:
        description: the callerId for faxes send by this user
        type: string
      faxHeader:
        description: the header for faxes send by this user
        type: string
      faxCoverPage:
        description: whether to send a cover page for faxes send by this user
        type: boolean
      faxEmailJournal:
        description: whether the user recieves a email journal of send faxes
        type: boolean

    required:
      - email
      - login
      - familyName
      - firstName

  PhoneConfig:
    description: Representation of phone config options for a User
    properties:
      primaryPhoneId:
        description: the Id of the primary Phone of the User
        type: integer
        format: int32
      displayNumberId:
        description: the Id of the PhoneNumber that is displayed when the User makes a call
        type: integer
        format: int32
      callWaiting:
        description: the flag that indicates whether a call gets rejected if the User is currently busy
        type: boolean
      doNotDisturb:
        description: the flag that indicates whether the user is DND and thus won't recieve calls
        type: boolean
    required:
      - primaryPhoneId
      - displayNumberId
      - callWaiting
      - doNotDisturb

  PhoneAssignment:
    description: Representation of an assignment from a Phone to a User
    properties:
      userId:
        description: the Id of the User
        type: integer
        format: int32
      phoneId:
        description: the Id of the Phone that is assigned to the User
        type: integer
        format: int32
      active:
        description: the flag that indicates whether the Phone is active for the User. Inactive Phones won't ring on incoming calls.
        type: boolean
      phoneName:
        description: The name of the Phone that is assigned to the User.
        type: string
      isIFMC:
        description: the flag that indicates whether the assigned Phone is a STARFACE iFMC Phone
        type: boolean

  NumberForPhoneAssignment:
    description: Representation of an assignment from a PhoneNumber to a Phone.
    properties:
      phoneNumberId:
        description: the Id of the PhoneNumber that is assigned
        type: integer
        format: int32
      phoneNumber:
        description: The number of the PhoneNumber
        type: string
      active:
        description: the flag that indicates whether the PhoneNumber is active for this assignment.
        type: boolean            
