swagger: '2.0'
info:
  description: >-
    Service for configuring, reading and managing assets, asset types and aspect
    types.
  version: 3.16.3
  x-visibility: external
  title: Asset Management API
basePath: /api/assetmanagement/v3
tags:
  - name: aspecttype
    description: Managing static and dynamic aspect types.
  - name: assettype
    description: Managing asset types.
  - name: assets
    description: >-
      Managing users' assets and their locations. Assets only can be created by
      types which are in three main topics; device types, agent types and
      hierarchy types.
  - name: structure
    description: Managing structure of specific assets.
  - name: locations
    description: Managing locations.
  - name: files
    description: Managing files.
  - name: assetmodellock
    description: Managing locks on asset model
  - name: billboard
schemes:
  - https
produces:
  - application/hal+json
  - application/vnd.error+json
consumes:
  - application/json
securityDefinitions:
  assettype:
    type: oauth2
    flow: accessCode
    authorizationUrl: 'https://oauth.simple.api/authorization'
    tokenUrl: 'https://oauth.simple.api/token'
    scopes:
      atm.w: create or update asset types
      atm.r: read asset types
      atm.d: delete asset types
  assetmodel:
    type: oauth2
    flow: accessCode
    authorizationUrl: 'https://oauth.simple.api/authorization'
    tokenUrl: 'https://oauth.simple.api/token'
    scopes:
      aml.r: read lock state of an asset model
      aml.w: enable/disable lock state of an asset model
  aspecttype:
    type: oauth2
    flow: accessCode
    authorizationUrl: 'https://oauth.simple.api/authorization'
    tokenUrl: 'https://oauth.simple.api/token'
    scopes:
      atm.apt.r: read aspect types
      atm.apt.w: write aspect types
      atm.apt.d: delete aspect types
  asset:
    type: oauth2
    flow: accessCode
    authorizationUrl: 'https://oauth.simple.api/authorization'
    tokenUrl: 'https://oauth.simple.api/token'
    scopes:
      asm.c: create assets
      asm.r: read asset
      asm.u: update assets
      asm.d: delete assets
      asm.m: move asset
      asm.h.w: create or modify hierarchy of assets
      asm.h.d: delete an element of the hierarchy of assets
      asm.rh.w: create or modify root hierarchy of assets
      asm.rh.d: delete a root element of the hierarchy of assets
  location:
    type: oauth2
    flow: accessCode
    authorizationUrl: 'https://oauth.simple.api/authorization'
    tokenUrl: 'https://oauth.simple.api/token'
    scopes:
      asm.loc.w: write location
      asm.loc.d: delete location
  file:
    type: oauth2
    flow: accessCode
    authorizationUrl: 'https://oauth.simple.api/authorization'
    tokenUrl: 'https://oauth.simple.api/token'
    scopes:
      asm.f.r: read files
      asm.f.w: write files
      asm.f.d: delete files
      asm.fa.w: assign files
      asm.fa.d: delete file assignments
      atm.fa.w: create file assignment to assettype
      atm.fa.d: delete file assignment from assettype
paths:
  /:
    get:
      tags:
        - billboard
      summary: List all links for available resources
      operationId: getBillboard
      description: List all links for available resources
      security:
        - assettype:
            - atm.r
      responses:
        '200':
          description: Array of links to available resources
          schema:
            $ref: '#/definitions/BillboardResource'
  /assettypes:
    get:
      tags:
        - assettype
      summary: List all asset types
      operationId: listAssetTypes
      description: List all asset types
      security:
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
      parameters:
        - $ref: '#/parameters/page'
        - $ref: '#/parameters/size'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/filter'
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/exploded'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Array of asset types matched the tenant scope and filter criterias
          headers:
            ETag:
              type: string
              description: Shallow ETag of the resource
          schema:
            $ref: '#/definitions/AssetTypeListResource'
        '304':
          description: Asset-types page not changed
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assettypes/{id}':
    put:
      tags:
        - assettype
      summary: Create or Update an asset type
      operationId: saveAssetType
      description: >
        Create or Update an asset type. User can increase the length of a STRING
        variable. The length cannot be decreased. User can remove existing variables and aspects.
      security:
        - assettype:
            - atm.w
        - aspecttype:
            - atm.apt.r
        - file:
            - atm.fa.w
            - atm.fa.d
      parameters:
        - $ref: '#/parameters/ifMatch'
        - $ref: '#/parameters/ifNoneMatchStar'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/exploded'
        - $ref: '#/parameters/includeShared'
        - name: assettype
          in: body
          description: asset type
          required: true
          schema:
            $ref: '#/definitions/AssetType'
      responses:
        '200':
          description: The asset type has been updated
          schema:
            $ref: '#/definitions/AssetTypeResource'
        '201':
          description: The asset type has been created
          schema:
            $ref: '#/definitions/AssetTypeResource'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: AssetType is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    patch:
      consumes:
        - application/merge-patch+json
      tags:
        - assettype
      summary: Patch an asset type
      operationId: updateAssetType
      description: >
        Patch an asset type. Patching requires the inclusion of all existing
        variables and aspects. Missing file assignments will be deleted, missing variables and aspects will be deleted. Other
        fields may be omitted. Conforms to RFC 7396 - JSON merge Patch.
      security:
        - assettype:
            - atm.w
        - aspecttype:
            - atm.apt.r
        - file:
            - atm.fa.w
            - atm.fa.d
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/exploded'
        - $ref: '#/parameters/includeShared'
        - name: assettype
          in: body
          description: asset type
          required: true
          schema:
            $ref: '#/definitions/AssetType'
      responses:
        '200':
          description: The asset type has been updated
          schema:
            $ref: '#/definitions/AssetTypeResource'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: AssetType not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: AssetType is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    get:
      tags:
        - assettype
      summary: Read an asset type
      operationId: getAssetType
      description: Read an asset type
      security:
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
      parameters:
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/exploded'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Returns the asset type
          schema:
            $ref: '#/definitions/AssetTypeResource'
        '304':
          description: AssetType not changed
          schema:
            $ref: '#/definitions/errors'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - assettype
      summary: Delete an asset type
      operationId: deleteAssetType
      description: >-
        Deletes an asset type. Deletion only possible when the type has no
        child-type and there is no asset that instantiate it.
      security:
        - assettype:
            - atm.d
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/includeShared'
      responses:
        '204':
          description: Asset type deletion was successful
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: AssetType is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assettypes/{id}/fileAssignments/{key}':
    put:
      tags:
        - assettype
      summary: Add a new file assignment to an asset type
      operationId: saveAssetTypeFileAssignment
      description: >
        Add a new file assignment to a given asset type. All asset which extends
        these types will have its file by default.
      security:
        - assettype:
            - atm.r
        - file:
            - atm.fa.w
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/fileKey'
        - $ref: '#/parameters/includeShared'
        - name: assignment
          in: body
          required: true
          description: Data for file assignment
          schema:
            $ref: '#/definitions/KeyedFileAssignment'
      responses:
        '200':
          description: The assignment has been updated or a new assignment has been added
          schema:
            $ref: '#/definitions/AssetTypeResource'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset type not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset type or the file assignment has changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - assettype
      summary: Deletes a file assignment from an asset type
      operationId: deleteAssetTypeFileAssignment
      description: >
        Deletes a file assignment from an asset type.

        If the type's parent has defined a file with the same key, the key will
        be displayed with the inherited value.
      security:
        - assettype:
            - atm.r
        - file:
            - atm.fa.d
      parameters:
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/fileKey'
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: The assignment has been deleted
          schema:
            $ref: '#/definitions/AssetTypeResource'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset type or key not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset type or the file assignment has changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assettypes/{id}/variables':
    patch:
      consumes:
        - application/merge-patch+json
      tags:
        - assettype
      summary: Update variables from an asset type
      operationId: updateAssetTypeVariable
      description: >
        Updates an existing variable defined on an asset type. Variables cannot be added or deleted using this operation, for adding or deleting variables use patch/put assettype api. Any variable which is not part of the request will remain unchanged.
        Variable's Name, Length, Default Value and Unit can be changed.
        The unit changes from the api does not compute any value changes derived after the unit changes, the values will remain as it is and only the unit will be updated.
        The length can only be increased of a string variable and it cannot be decreased. This operation will increment the asset type etag value.
      security:
        - assettype:
            - atm.w
      parameters:
        - $ref: '#/parameters/ifMatchVariable'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/includeShared'
        - name: variableMap
          in: body
          required: true
          description: Variables Dictionary, Variable Name is the key and value are the parameters to be updated of the variable.
          schema:
            $ref: '#/definitions/VariableUpdateMap'
      responses:
        '204':
          description: The variable's has been updated
          headers:
            ETag:
              type: integer
              description: AssetType ETag value for further updates
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Variable not found in Asset type
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset type or the variable has been changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  /aspecttypes:
    get:
      tags:
        - aspecttype
      summary: List all aspect types
      operationId: listAspectTypes
      description: List all aspect types
      security:
        - aspecttype:
            - atm.apt.r
      parameters:
        - $ref: '#/parameters/page'
        - $ref: '#/parameters/size'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/filter'
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Array of aspect types matched the tenant scope and filter criterias
          headers:
            ETag:
              type: string
              description: Shallow ETag of the resource
          schema:
            $ref: '#/definitions/AspectTypeListResource'
        '304':
          description: Aspect-types page not changed
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/aspecttypes/{id}':
    put:
      tags:
        - aspecttype
      summary: Create or Update an aspect type
      operationId: saveAspectType
      description: >
        Create or Update an aspect type.
        Only adding variables and restricted updates on variables is supported, like user can change unit details, can increase the length of a static STRING variable but length of a dynamic STRING variable cannot be changed.
        Default value field is available only for static aspect variables and not on dynamic aspect variable. Aspect type description should not contain single quote character.
      security:
        - aspecttype:
            - atm.apt.w
      parameters:
        - $ref: '#/parameters/ifMatch'
        - $ref: '#/parameters/ifNoneMatchStar'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/includeShared'
        - name: aspecttype
          in: body
          description: aspect type
          required: true
          schema:
            $ref: '#/definitions/AspectType'
      responses:
        '200':
          description: The aspect type has been updated
          schema:
            $ref: '#/definitions/AspectTypeResource'
        '201':
          description: The aspect type has been created
          schema:
            $ref: '#/definitions/AspectTypeResource'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: AspectType not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: AspectType is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    patch:
      consumes:
        - application/merge-patch+json
      tags:
        - aspecttype
      summary: Patch an aspect type
      operationId: updateAspectType
      description: >-
        Patch an aspect type. Only adding variables and restricted updates on variables is supported, like user can change unit details, can increase the length of a static STRING variable but length of a dynamic STRING variable cannot be changed.
        Conforms to RFC 7396 - JSON merge Patch.
      security:
        - aspecttype:
            - atm.apt.w
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/includeShared'
        - name: aspecttype
          in: body
          description: aspect type
          required: true
          schema:
            $ref: '#/definitions/AspectType'
      responses:
        '200':
          description: The aspect type has been updated
          schema:
            $ref: '#/definitions/AspectTypeResource'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: AspectType not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: AspectType is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    get:
      tags:
        - aspecttype
      summary: Read an aspect type
      operationId: getAspectType
      description: Read an aspect type.
      security:
        - aspecttype:
            - atm.apt.r
      parameters:
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Returns the aspect type
          schema:
            $ref: '#/definitions/AspectTypeResource'
        '304':
          description: AspectType not changed
          schema:
            $ref: '#/definitions/errors'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: AspectType not found
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - aspecttype
      summary: Delete aspect type
      operationId: deleteAspectType
      description: >-
        Delete an aspect type. Aspect type can only be deleted if there is no
        asset type using it.
      security:
        - aspecttype:
            - atm.apt.d
        - assettype:
            - atm.r
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/TypeId'
        - $ref: '#/parameters/includeShared'
      responses:
        '204':
          description: Aspect type deletion was successful
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: AspectType not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: AspectType is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  /assets:
    get:
      tags:
        - assets
      summary: List all available assets
      operationId: listAssets
      description: >
        List all assets available for the authenticated user.


        ## Filter


        Supports all basic fields and the 'hasType' filter which search for the
        assets with type that originated from the given asset type.


        # Examples


        Example:


        This filter searches for assets which type is exactly the given type:

        ```

        { "typeId": "mandal.ship" }

        ```

        Beyond the basic fields we can search for assets which type is inherited
        from the given type:

        ```

        { "hasType": "mandal.ship" }

        ```
      security:
        - asset:
            - asm.r
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
      parameters:
        - $ref: '#/parameters/page'
        - $ref: '#/parameters/size'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/filter'
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/includeShared'
        - $ref: '#/parameters/basicFieldsOnly'
      responses:
        '200':
          description: Array of assets matched the tenant scope and filter criterias
          headers:
            ETag:
              type: string
              description: The hash of the response's content
          schema:
            $ref: '#/definitions/AssetListResource'
        '304':
          description: The answer's content has not changed since the last request
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    post:
      tags:
        - assets
      summary: Create an asset
      operationId: addAsset
      description: >-
        Creates a new asset with the provided content. Only instantiable types
        could be used.
      security:
        - asset:
            - asm.c
            - asm.h.w
            - asm.rh.w
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
        - location:
            - asm.loc.w
        - file:
            - asm.fa.w
      parameters:
        - $ref: '#/parameters/includeShared'
        - name: asset
          in: body
          description: asset
          required: true
          schema:
            $ref: '#/definitions/Asset'
      responses:
        '201':
          description: The asset is created
          headers:
            Location:
              type: string
              description: URL of the created resource
              format: uri
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assets/{id}':
    get:
      tags:
        - assets
      summary: Returns an asset.
      operationId: getAsset
      description: Read a single asset. All static properties of asset are returned.
      security:
        - asset:
            - asm.r
        - assettype:
            - atm.r
      parameters:
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Returns an asset with its static properties.
          headers:
            ETag:
              type: string
              description: ETag hash of the resource
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '304':
          description: Resource asset is not modified
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Not found
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    put:
      tags:
        - assets
      summary: Update an asset
      operationId: replaceAsset
      description: >-
        Updates an asset with the provided content. Only values can be modified,
        asset's structure have to be modified in asset's type
      security:
        - asset:
            - asm.u
            - asm.h.w
            - asm.rh.w
        - file:
            - asm.fa.w
            - asm.fa.d
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
        - location:
            - asm.loc.w
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/includeShared'
        - name: asset
          in: body
          description: asset
          required: true
          schema:
            $ref: '#/definitions/AssetUpdate'
      responses:
        '200':
          description: The asset is updated
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    patch:
      consumes:
        - application/merge-patch+json
      tags:
        - assets
      summary: Patch an asset
      operationId: updateAsset
      description: >-
        Patch an asset with the provided content. Only values can be modified,
        asset's structure have to be modified in asset's type. Conforms to RFC
        7396 - JSON merge Patch.
      security:
        - asset:
            - asm.u
            - asm.h.w
            - asm.rh.w
        - file:
            - asm.fa.w
            - asm.fa.d
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
        - location:
            - asm.loc.w
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/includeShared'
        - name: asset
          in: body
          description: asset
          required: true
          schema:
            $ref: '#/definitions/AssetUpdate'
      responses:
        '200':
          description: The asset is updated
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - assets
      summary: Delete an asset
      operationId: deleteAsset
      description: >-
        Deletes the given asset. It's not possible to
        delete an asset if it has children.
      security:
        - asset:
            - asm.d
            - asm.h.d
            - asm.rh.d
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/includeShared'
      responses:
        '204':
          description: Asset deletion was successful
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assets/{id}/move':
    post:
      tags:
        - assets
      summary: Move an asset
      operationId: moveAsset
      description: Moves an asset (and all it's children) in the instance hierarchy
      security:
        - asset:
            - asm.r
            - asm.m
            - asm.h.w
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/includeShared'
        - name: moveParameters
          in: body
          description: parameters for the asset move
          required: true
          schema:
            $ref: '#/definitions/AssetMove'
      responses:
        '200':
          description: The asset is moved
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assets/{id}/variables':
    get:
      tags:
        - structure
      summary: Get all variables of an asset
      operationId: listAssetVariables
      description: |
        Get all variables of a given asset including inherited ones
      security:
        - asset:
            - asm.r
        - assettype:
            - atm.r
      parameters:
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/page'
        - $ref: '#/parameters/size'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/filter'
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Variables of the given asset matched by the given filter criterias
          headers:
            ETag:
              type: string
              description: ETag hash of the resource
          schema:
            $ref: '#/definitions/VariableListResource'
        '304':
          description: Resource variables have not been modified
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assets/{id}/aspects':
    get:
      tags:
        - structure
      summary: Get all aspects of an asset
      operationId: listAssetAspects
      description: |
        Get all static and dynamic aspects of a given asset
      security:
        - asset:
            - asm.r
        - assettype:
            - atm.r
        - aspecttype:
            - atm.apt.r
      parameters:
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/page'
        - $ref: '#/parameters/size'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/filter'
        - $ref: '#/parameters/ifNoneMatch'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: >-
            Static and dynamic aspects of the given asset matched by the given
            filter criterias
          headers:
            ETag:
              type: string
              description: ETag hash of the resource
          schema:
            $ref: '#/definitions/AspectListResource'
        '304':
          description: Resource aspects have not been modified
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assets/{id}/fileAssignments/{key}':
    put:
      tags:
        - assets
      summary: Save an file assignment to an asset
      operationId: saveAssetFileAssignment
      description: |
        Save a file assignment to a given asset
      security:
        - asset:
            - asm.r
        - file:
            - asm.fa.w
      parameters:
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/fileKey'
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/includeShared'
        - name: assignment
          in: body
          required: true
          description: Data for file assignment
          schema:
            $ref: '#/definitions/KeyedFileAssignment'
      responses:
        '200':
          description: The assignment has been updated or a new assignment has been added
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset or the file assignment has changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - assets
      summary: Deletes a file assignment from an asset
      operationId: deleteAssetFileAssigment
      description: >
        Deletes a file assignment from an asset.

        If the asset's parent type has defined a file with the same key, the key
        will be displayed with the inherited value.
      security:
        - asset:
            - asm.r
        - assettype:
            - atm.r
        - file:
            - asm.fa.d
      parameters:
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/fileKey'
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: The assignment has been deleted
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset or key not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Asset or the file assignment has changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  /assets/root:
    get:
      tags:
        - assets
      summary: Returns the root asset of the user.
      operationId: getRootAsset
      description: >-
        Read the root asset of the user, from which the whole asset hierarchy
        can be rebuilt.
      security:
        - asset:
            - asm.r
        - assettype:
            - atm.r
      parameters:
        - $ref: '#/parameters/ifNoneMatch'
      responses:
        '200':
          description: Returns the root asset of the user.
          headers:
            ETag:
              type: string
              description: ETag hash of the resource
          schema:
            $ref: '#/definitions/RootAssetResource'
        '304':
          description: Resource asset is not modified
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Not found
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/assets/{id}/location':
    put:
      tags:
        - locations
      summary: Create or Update location assigned to given asset
      operationId: saveAssetLocation
      description: >
        * If the given asset has own location, this endpoint will update that
        location.

        * If the given asset has no location, this endpoint will create a new
        location and update the given asset.

        * If the given asset has inherited location, this endpoint will create a
        new location and update the given asset. If you wanted to update the
        inherited location you have to use the 'location' url in AssetResource
        object (with PUT method).
      security:
        - asset:
            - asm.r
        - location:
            - asm.loc.w
        - assettype:
            - atm.r
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/includeShared'
        - name: location
          in: body
          description: location
          required: true
          schema:
            $ref: '#/definitions/Location'
      responses:
        '200':
          description: Location has been successfully created or updated
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found with given asset identifier
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Location is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - locations
      summary: Delete location assigned to given asset.
      operationId: deleteAssetLocation
      description: >
        * Only those locations can be deleted here which assigned to the given
        asset.

        * If the location inherited from an ancestor asset, you have to delete
        the location with the assigned assetId (using ‘location’ url in
        AssetResource object with DELETE method).

        * The response contains the updated AssetResource with the inherited
        Location details.
      security:
        - asset:
            - asm.r
        - location:
            - asm.loc.d
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/uniqueId'
        - $ref: '#/parameters/includeShared'
      responses:
        '200':
          description: Location has been successfully deleted
          schema:
            $ref: '#/definitions/AssetResourceWithHierarchyPath'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: Asset not found with given asset identifier
          schema:
            $ref: '#/definitions/errors'
        '409':
          description: Location not assigned to the given asset
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
        '503':
          description: 'Service unavailable, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  /files:
    post:
      tags:
        - files
      summary: Upload files to be used in Asset Management.
      operationId: uploadFile
      description: |
        * Uploaded files are only visible for the uploader tenant.
        * Max file size is 5 MB.
      security:
        - file:
            - asm.f.w
      consumes:
        - multipart/form-data
      parameters:
        - name: file
          in: formData
          type: file
          format: binary
          required: true
          description: The file to upload. The file size cannot be more than 5 MB.
        - name: name
          in: formData
          type: string
          pattern: '^[^*&%\s\/\\]+$'
          required: true
          maxLength: 255
          description: The name of the file
        - name: scope
          in: formData
          type: string
          enum:
            - public
            - private
          default: private
          required: false
          description: The scope of the file
        - name: description
          in: formData
          type: string
          maxLength: 255
          description: The description of the file
      responses:
        '201':
          description: File has been successfully uploaded
          headers:
            Location:
              type: string
              description: URL of the created resource
              format: uri
          schema:
            $ref: '#/definitions/FileMetadataResource'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    get:
      tags:
        - files
      summary: Get metadata of uploaded files.
      operationId: listFiles
      description: >
        Returns all visible file metadata for the tenant. Will NOT return the
        files.
      security:
        - file:
            - asm.f.r
      parameters:
        - $ref: '#/parameters/page'
        - $ref: '#/parameters/size'
        - $ref: '#/parameters/sort'
        - $ref: '#/parameters/filter'
        - $ref: '#/parameters/ifNoneMatch'
      responses:
        '200':
          description: Metadata of files visible for the tenant
          schema:
            $ref: '#/definitions/FileMetadataListResource'
        '304':
          description: Resource have not been modified
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/files/{fileId}/file':
    get:
      tags:
        - files
      summary: Returns a file by its id
      operationId: downloadFile
      description: |
        Returns a file by its id
      security:
        - file:
            - asm.f.r
      produces:
        - application/base64
        - application/octet-stream
        - application/vnd.error+json
      parameters:
        - $ref: '#/parameters/fileId'
      responses:
        '200':
          description: Returns the file
          schema:
            type: string
            format: binary
            description: The requested file as a base64 encoded string or an octet-stream
            example: QW4gZXhhbXBsZSBmaWxl
          headers:
            Content-Type:
              type: string
              description: The uploaded file resource's media type
              format: Media type
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: File not found
          schema:
            $ref: '#/definitions/errors'
        '406':
          description: >-
            The resource cannot be represented in the format that would be
            acceptable to the user agent
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/files/{fileId}':
    get:
      tags:
        - files
      summary: Returns a file's metadata by its id
      operationId: getFile
      description: |
        Returns a file's metadata by its id
      security:
        - file:
            - asm.f.r
      parameters:
        - $ref: '#/parameters/fileId'
        - $ref: '#/parameters/ifNoneMatch'
      responses:
        '200':
          description: Returns the file's metadata
          schema:
            $ref: '#/definitions/FileMetadataResource'
        '304':
          description: Resource have not been modified
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: File not found
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    put:
      tags:
        - files
      summary: Update a file
      operationId: replaceFile
      description: |
        Update a previously uploaded file
        * Max file size is 5 MB.
      security:
        - file:
            - asm.f.w
      consumes:
        - multipart/form-data
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/fileId'
        - name: file
          in: formData
          type: file
          format: binary
          required: true
          description: The file to upload. The file size cannot be more than 5 MB.
        - name: name
          in: formData
          type: string
          pattern: '^[^*&%\s\/\\]+$'
          required: true
          maxLength: 255
          description: The name of the file
        - name: scope
          in: formData
          type: string
          enum:
            - public
            - private
          default: private
          required: true
          description: The scope of the file
        - name: description
          in: formData
          type: string
          maxLength: 255
          description: The description of the file
      responses:
        '200':
          description: File has been successfully updated
          schema:
            $ref: '#/definitions/FileMetadataResource'
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: File not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: File is changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
    delete:
      tags:
        - files
      summary: Delete a file.
      operationId: deleteFile
      description: >
        * Deletion is blocked if there are any file assignment with the given
        fileId.
      security:
        - file:
            - asm.f.d
      parameters:
        - $ref: '#/parameters/ifMatchMandatory'
        - $ref: '#/parameters/fileId'
      responses:
        '204':
          description: File has been successfully deleted
        '400':
          description: Invalid request
          schema:
            $ref: '#/definitions/errors'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '404':
          description: File not found
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: File changed in the background
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'
  '/model/lock':
    get:
      tags:
        - assetmodellock
      summary: Returns lock state of an asset model.
      operationId: getAssetModelLock
      description: >-
        Provides lock state of an asset model at tenant level.
      security:
        - assetmodel:
            - aml.r
      responses:
        '200':
          description: Returns lock state of an asset model and associated jobs.
          schema:
            $ref: '#/definitions/AssetModelLock'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'

    put:
      tags:
        - assetmodellock
      summary: Enable/disable lock state of an asset model.
      operationId: putAssetModelLock
      description: >-
        Enable/disable lock state of asset model at tenant level, managing restrictions on update/delete operations on assettypes and aspecttypes.
      security:
        - assetmodel:
            - aml.w
      parameters:
        - name: enabled
          in: query
          description: Lock state of an asset model
          required: true
          type: boolean
          default: false

      responses:
        '200':
          description: Returns lock state of an asset model applied on a tenant.
          schema:
            $ref: '#/definitions/ModelLock'
        '401':
          description: User is not authenticated
          schema:
            $ref: '#/definitions/errors'
        '403':
          description: User is not authorized for request
          schema:
            $ref: '#/definitions/errors'
        '412':
          description: Precondition Failed
          schema:
            $ref: '#/definitions/errors'
        '429':
          description: Too Many Requests
          schema:
            $ref: '#/definitions/errors'
        '500':
          description: 'Server error, for more information see errorcode and message'
          schema:
            $ref: '#/definitions/errors'

definitions:
  AssetTypeBase:
    type: object
    required:
      - name
    properties:
      name:
        type: string
        minLength: 1
        maxLength: 128
        pattern: '[\p{L}_0-9_\. ]+'
        description: The type's name.
        example: X_Wing
      description:
        type: string
        description: description
        maxLength: 255
        example: Hyperspace jump capable space ship
      parentTypeId:
        $ref: '#/definitions/AssetTypeId'
      instantiable:
        type: boolean
        default: true
        example: true
        description: >-
          If instances can be created from this type. A non-instantiable type
          could be changed to be instantiable but not the other way around.
      scope:
        type: string
        enum:
          - public
          - private
        default: private
        example: private
        description: >-
          Visibility of the assettype. Setting this property to public makes it
          available to other tenants. Private types are only visible to the
          user's own tenant. Currently only private types could be created.
  AssetType:
    type: object
    allOf:
      - $ref: '#/definitions/AssetTypeBase'
      - properties:
          aspects:
            type: array
            description: Aspects of the asset-type.
            items:
              type: object
              required:
                - name
                - aspectTypeId
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 64
                  pattern: '[a-zA-Z0-9_]+'
                  example: leftWing
                  description: >-
                    Name of the aspect. It has to be unique inside the
                    type-family (ancestors and descendants).Cannot be changed.
                    Reserved words (id, name, description, tenant, etag, scope,
                    properties, propertySets, extends, variables, aspects,
                    parentTypeId) cannot be used as aspect names.
                aspectId:
                  $ref: '#/definitions/AspectId'
                aspectTypeId:
                  $ref: '#/definitions/AspectTypeId'
          variables:
            type: array
            description: >-
              Direct variables of the asset-type. Variable names has to be
              unique inside the whole type-family (ancestors and descendants).
              Once added variables cannot be changed or removed.
            items:
              $ref: '#/definitions/VariableDefinition'
          fileAssignments:
            type: array
            items:
              $ref: '#/definitions/FileAssignment'
  AssetTypeResource:
    type: object
    allOf:
      - $ref: '#/definitions/AssetTypeBase'
      - properties:
          id:
            $ref: '#/definitions/AssetTypeId'
          tenantId:
            $ref: '#/definitions/tenantId'
          etag:
            $ref: '#/definitions/ETag'
          aspects:
            type: array
            items:
              type: object
              properties:
                name:
                  type: string
                  description: >-
                    Name of the aspect type, it must be unique for the asset
                    type.
                  example: leftWing
                aspectId:
                  $ref: '#/definitions/AspectId'
                aspectType:
                  allOf:
                    - $ref: '#/definitions/AspectTypeResource'
                _links:
                  type: object
                  properties:
                    origin:
                      type: object
                      properties:
                        href:
                          type: string
                          description: >-
                            Link to the asset type defining the aspect. *Only
                            visible if aspect is inherited.*
          variables:
            type: array
            description: >-
              Direct variables of the asset-type. Variable names has to be
              unique inside the whole type-family (ancestors and descendants).
              Once added variables cannot be changed or removed.
            items:
              $ref: '#/definitions/VariableDefinitionResource'
          fileAssignments:
            type: array
            items:
              $ref: '#/definitions/FileAssignmentResource'
          sharing:
            $ref: '#/definitions/SharingResource'
          _links:
            $ref: '#/definitions/AssetTypeLinks'
  AssetTypeLinks:
    type: object
    properties:
      self:
        $ref: '#/definitions/rel.self'
      parent:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to the parent asset type
  AspectType:
    type: object
    required:
      - name
      - category
      - variables
    properties:
      name:
        type: string
        minLength: 1
        maxLength: 128
        pattern: '[a-zA-Z0-9_]+'
        description: >-
          Name of the aspect type. It has to be unique inside the tenant and
          cannot be changed later.
        example: engine
      category:
        type: string
        enum:
          - static
          - dynamic
        description: >-
          If the aspect-type is used for static data or time-series. Cannot be
          changed once the aspect-type is created.
      scope:
        type: string
        enum:
          - public
          - private
        default: private
        example: private
        description: >-
          Visibility of aspecttype. Setting this property to public makes it
          available to other tenants. Private types are only visible to the
          user's own tenant. Currently only private types can be created.
      description:
        type: string
        maxLength: 255
        pattern: '[^\'']*'
        description: The description of the aspect type
        example: The engine of the Millenium Falcon
      variables:
        type: array
        minItems: 1
        description: >-
          Variables of the aspect-type. Variable names should be unique inside an aspect-type. Once a variable is added to the aspect that it cannot be renamed or removed, although updating variable unit is allowed. Only variables of static aspect-type can have default values.
        items:
          $ref: '#/definitions/AspectVariable'
  AspectTypeResource:
    type: object
    allOf:
      - $ref: '#/definitions/AspectType'
      - properties:
          id:
            $ref: '#/definitions/AspectTypeId'
          tenantId:
            $ref: '#/definitions/tenantId'
          etag:
            $ref: '#/definitions/ETag'
          sharing:
            $ref: '#/definitions/SharingResource'
          _links:
            $ref: '#/definitions/AspectTypeLinks'
  AspectTypeLinks:
    type: object
    properties:
      self:
        $ref: '#/definitions/rel.self'
  uniqueId:
    type: string
    pattern: '[0-9a-f]+'
    minLength: 32
    maxLength: 32
    example: c27a28b6eb16b507fabc11e75da8b4ce
  Asset:
    type: object
    required:
      - typeId
      - parentId
    allOf:
      - $ref: '#/definitions/AssetUpdate'
      - properties:
          typeId:
            $ref: '#/definitions/AssetTypeId'
          parentId:
            $ref: '#/definitions/uniqueId'
          timezone:
            $ref: '#/definitions/timezone'
          twinType:
            $ref: '#/definitions/twinType'
  twinType:
    type: string
    description: >-
      Indicates that the asset is a real asset (performance) or for simulation.
      If omitted on creation then it defaults to performance. Setting the
      twinType to simulation allows high resolution timestamps (microsecond
      precision).
    enum:
      - performance
      - simulation
    default: performance
  AssetUpdate:
    type: object
    required:
      - name
    properties:
      name:
        type: string
        minLength: 1
        maxLength: 128
        pattern: '[^\/\\]*'
        description: Name of the asset
        example: Millenium Falcon
      externalId:
        type: string
        description: The id given by the user
        maxLength: 255
        example: SN 123456-123-123456
      description:
        type: string
        description: The description of the asset
        maxLength: 255
        example: The ship of Han Solo and Chewbacca
      location:
        $ref: '#/definitions/Location'
      variables:
        type: array
        items:
          $ref: '#/definitions/Variable'
      aspects:
        type: array
        items:
          $ref: '#/definitions/Aspect'
      fileAssignments:
        type: array
        items:
          $ref: '#/definitions/FileAssignment'
  AssetMove:
    type: object
    required:
      - newParentId
    properties:
      newParentId:
        $ref: '#/definitions/uniqueId'
  AssetResource:
    allOf:
      - $ref: '#/definitions/Asset'
      - properties:
          tenantId:
            $ref: '#/definitions/tenantId'
          subTenant:
            type: string
            description: The id of the end-customer.
            maxLength: 255
            example: UnkarPlutt Inc.
          t2Tenant:
            type: string
            description: >-
              The id of the end-customer. This field is DEPRECATED please use
              subTenant instead.
            maxLength: 255
            example: 'DEPRECATED: use subTenant instead'
          assetId:
            $ref: '#/definitions/uniqueId'
          fileAssignments:
            type: array
            items:
              $ref: '#/definitions/FileAssignmentResource'
          locks:
            type: array
            items:
              $ref: '#/definitions/LockResource'
          deleted:
            type: string
            format: date-time
          twinType:
            type: string
            enum:
              - performance
              - simulation
            default: performance
          sharing:
            $ref: '#/definitions/SharingResource'
          etag:
            $ref: '#/definitions/ETag'
          _links:
            $ref: '#/definitions/AssetLinks'
  RootAssetResource:
    allOf:
      - $ref: '#/definitions/AssetResource'
      - properties:
          hierarchyPath:
            type: array
            items:
              type: string
            example: []
            description: Hieararchy path is empty for the root asset
  AssetResourceWithHierarchyPath:
    allOf:
      - $ref: '#/definitions/AssetResource'
      - properties:
          hierarchyPath:
            type: array
            items:
              type: object
              properties:
                assetId:
                  $ref: '#/definitions/uniqueId'
                name:
                  type: string
                  description: Name of the asset
                  example: Millenium Falcon's parent
  SharingResource:
    type: object
    description: >-
      Contains sharing information.
    properties:
      modes:
        type: array
        description: >-
          List of sharing modes applicable for this resource. The currently supported modes are SHARER and RECEIVER.
          SHARER means this resource is shared by my tenant.
          RECEIVER means this resource is shared with my tenant.
          An empty array means this resource is not shared.
          New modes might be introduced later and clients must expect additional items to be contained in the array.
        items:
          type: string
          enum: [ SHARER, RECEIVER ]
  AssetLinks:
    type: object
    properties:
      self:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to get the asset
      parent:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to get the parent of the asset
      children:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to get the children of the asset
      variables:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to get the variable definitions of the asset
      aspects:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to get the aspect structure of the asset
      t2Tenant:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to get the end-customer of the asset
      location:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: URL to update or delete the location of the asset
  Location:
    type: object
    properties:
      country:
        type: string
        maxLength: 255
        example: Austria
      region:
        type: string
        description: County or other region code or name
        maxLength: 255
        example: Tyrol
      locality:
        type: string
        maxLength: 255
        pattern: '[\p{L}0-9_ -\'']*'
        example: Innsbruck
      streetAddress:
        type: string
        maxLength: 255
        example: Industriestraße 21 A/II
      postalCode:
        type: string
        maxLength: 255
        example: '6020'
      longitude:
        type: number
        description: The longitude part of the geographic coordinates
        minimum: -180
        maximum: 180
        example: 53.5125546
      latitude:
        type: number
        description: The latitude part of the geographic coordinates
        minimum: -90
        maximum: 90
        example: 9.9763411
  LockResource:
    type: object
    properties:
      id:
        $ref: '#/definitions/uniqueId'
      service:
        type: string
        description: Service creating the lock
        example: AgentManagement
      reason:
        type: string
        description: Reason of lock
        example: 'Agent is onboarded, cannot delete asset until offboard finished'
      reasonCode:
        type: string
        description: Code of the reason
        example: agentmanagement.agent.onboarded
      _links:
        type: object
        properties:
          self:
            $ref: '#/definitions/rel.self'
  FileAssignmentResource:
    type: object
    allOf:
      - $ref: '#/definitions/FileAssignment'
      - properties:
          _links:
            $ref: '#/definitions/FileAssignmentLinks'
  AspectVariable:
    type: object
    allOf:
      - $ref: '#/definitions/VariableDefinition'
      - properties:
          qualityCode:
            type: boolean
            default: false
            description: >-
              Indicates whether the variable has quality code. Cannot be
              changed.
            example: true
  Aspect:
    type: object
    properties:
      name:
        type: string
        minLength: 1
        maxLength: 64
        pattern: '[a-zA-Z0-9_]+'
        example: astroDroid
      variables:
        type: array
        items:
          $ref: '#/definitions/Variable'
  AspectResource:
    type: object
    required:
      - name
    properties:
      aspectTypeId:
        type: string
        description: ID of the Aspect type
        example: tenant.asp.engine
      holderAssetId:
        $ref: '#/definitions/uniqueId'
      name:
        type: string
        pattern: '[a-zA-Z0-9_]+'
        description: Name of the aspect
        example: engine
      aspectId:
        $ref: '#/definitions/AspectId'
      category:
        type: string
        enum:
          - dynamic
          - static
      description:
        type: string
        pattern: '[^\'']*'
        description: The description of the aspect
        example: The engine of the Millenium Falcon
      variables:
        type: array
        items:
          $ref: '#/definitions/AspectVariable'
      _links:
        $ref: '#/definitions/AspectLinks'
  AspectLinks:
    type: object
    properties:
      self:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to the aspect
      asset:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to the asset
      aspectType:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to the origin aspect type of the aspect
  FileAssignmentLinks:
    type: object
    properties:
      download:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to download the file
      metadata:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to get metadata of the file
      origin:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: >-
              Link to access the file assignment. Only visible if assignment is
              inherited
  Variable:
    type: object
    properties:
      name:
        type: string
        minLength: 1
        maxLength: 64
        pattern: '[a-zA-Z0-9_]+'
        example: color
      value:
        type: string
        minLength: 1
        maxLength: 255
        example: yellow
  VariableUpdate:
    type: object
    properties:
      name:
        type: string
        minLength: 1
        maxLength: 64
        pattern: '[a-zA-Z_][a-zA-Z0-9_]*'
        description: >-
          Name of the variable. Once set cannot be changed. Reserved words (id,
          name, description, tenant, etag, scope, properties, propertySets,
          extends, variables, aspects, parentTypeId) cannot be used as variable
          names.
        example: temperature
      unit:
        type: string
        maxLength: 32
        pattern: '[^\'']*'
        description: Unit of measurement. Can be changed
        example: C/F
      length:
        type: integer
        minimum: 1
        maximum: 100000
        description: >-
          The max length of the variable's value. The length field is only used
          for variables of string or big_string dataType. Max length for string
          is 255 and max length for big_string 100000. Cannot be changed.
        example: 5
      defaultValue:
        type: string
        minLength: 1
        maxLength: 255
        description: >-
          The default value of the variable. It must be compatible with the
          dataType! The default value will be inherited by the asset type's
          child types and by the asset instantiating it. It can be defined in
          aspect types and asset types.
        example: 25/77
  VariableDefinition:
    allOf:
      - $ref: '#/definitions/VariableUpdate'
    required:
      - name
      - dataType
    properties:
      dataType:
        type: string
        enum:
          - BOOLEAN
          - INT
          - LONG
          - DOUBLE
          - STRING
          - TIMESTAMP
          - BIG_STRING
        description: >-
          Data type of the variable. BIG_STRING could only be used by variables
          in dynamic aspect-types. Cannot be changed.
        example: STRING
      searchable:
        type: boolean
        default: false
        description: >-
          Indicates whether sorting and filtering is allowed on this variable.
          Only usable for static properties. Cannot be changed.
        example: true
  VariableDefinitionResource:
    allOf:
      - $ref: '#/definitions/VariableDefinition'
      - properties:
          _links:
            properties:
              origin:
                description: >-
                  Link to the asset type defining the variable. *Only visible if
                  variable is inherited.*
                properties:
                  href:
                    type: string
  VariableUpdateMap:
    additionalProperties:
      $ref: '#/definitions/VariableUpdate'
    example: {
      "temperature" : {
        "name": "engine_temperature",
        "unit": "C/F",
        "length": 5,
        "defaultValue": "25/77"
      }
    }
  KeyedFileAssignment:
    type: object
    properties:
      fileId:
        type: string
        description: The id of the file to be assigned
        example: c27a28b6eb16b507fabc11e75da8b4ce
  FileAssignment:
    type: object
    properties:
      key:
        type: string
        pattern: '[\w]+'
        example: logo_small
        description: Keyword for the file to be assigned to an asset.
      fileId:
        type: string
        example: c27a28b6eb16b507fabc11e75da8b4ce
        description: The id of the file to be assigned
  FileMetadataResource:
    type: object
    properties:
      id:
        $ref: '#/definitions/uniqueId'
      name:
        type: string
        description: File name given by the user
        example: logo
      originalFileName:
        type: string
        description: Original filename of the file
        example: logo_small.png
      description:
        type: string
        description: File description
        example: Company logo
      tenantId:
        $ref: '#/definitions/tenantId'
      subTenant:
        type: string
        description: The id of the end-customer
        example: UnkarPlutt Inc.
      uploaded:
        description: The time of the file upload
        type: string
        format: date-time
      lastModified:
        description: The time of the latest modification of the file
        type: string
        format: date-time
      isAssigned:
        description: Is the file used in any file assignment
        type: boolean
        example: false
      scope:
        type: string
        enum:
          - public
          - private
        default: private
        example: private
        description: >-
          The visibility of the file. PRIVATE hides files between subTenants and
          the t1Tenant's files from the subTenants. PUBLIC is visible for every
          user of the tenant.
      etag:
        $ref: '#/definitions/ETag'
      _links:
        type: object
        properties:
          self:
            $ref: '#/definitions/rel.self'
          download:
            title: link for downloading the file
            properties:
              href:
                type: string
  tenantId:
    type: string
    pattern: '[a-zA-Z0-9-_.]+'
    maxLength: 255
    description: The unique identifier of the tenant
    example: mdsp
  enabled:
    type: boolean
    description: Describes the state of model lock
    example: true
  jobs:
    type: array
    items:
          type: string
    description: Describes Jobs associtated with Model Lock
    example: [mdsp-import-md33d31]
  timezone:
    type: string
    maxLength: 255
    description: >-
      The timezone to be used for timeseries aggregation. By default it is
      inherited from the tenant's defaultTimezone, but can be overwritten only during asset creation. The
      timezone value should be set to a Java time zone ID such as
      "America/LosAngeles" or "Etc/GMT+2". Time zones that 15 or 45 minutes off
      a UTC hour are not supported, such as Nepal standard time (UTC+05:45).
      Time zones that are 30 minutes off a UTC hour are supported, such as India
      (UTC+05:30). Once an asset is created with a specific timezone, it cannot be changed later.
    example: Europe/Berlin
  AssetTypeId:
    type: string
    minLength: 1
    maxLength: 128
    pattern: '[A-Za-z0-9_]{1,8}\.[A-Za-z0-9_]+'
    description: >-
      The asset type's id is a unique identifier. The id's length must be
      between 1 and 128 characters and matches the following symbols "A-Z",
      "a-z", "0-9", "_" and "." beginning with the tenant prefix what has a
      maximum of 8 characters. (e.g . ten_pref.type_id). Once set cannot be
      changed.
    example: mdsp.spaceship
  AspectId:
    type: string
    description: Aspect id is an internal id of an aspect associated with
      an asset type.
    example: b9cbfc7073be4530887cdb1e71c932b8
  AspectTypeId:
    type: string
    minLength: 1
    maxLength: 128
    pattern: '[A-Za-z0-9_]{1,8}\.[A-Za-z0-9_]+'
    description: >-
      The aspect type's id is a unique identifier. The id's length must be
      between 1 and 128 characters and matches the following symbols "A-Z",
      "a-z", "0-9", "_" and "." beginning with the tenant prefix what has a
      maximum of 8 characters. (e.g . ten_pref.type_id). Once set cannot be
      changed.
    example: mdsp.wing
  Page:
    type: object
    properties:
      size:
        type: integer
      totalElements:
        type: integer
      totalPages:
        type: integer
      number:
        type: integer
  PagingLinks:
    type: object
    properties:
      self:
        $ref: '#/definitions/rel.self'
      first:
        type: object
        title: link to first page
        properties:
          href:
            type: string
      prev:
        type: object
        title: link to previous page
        properties:
          href:
            type: string
      next:
        type: object
        title: link to next page
        properties:
          href:
            type: string
      last:
        type: object
        title: link to last page
        properties:
          href:
            type: string
  rel.self:
    type: object
    title: self link
    properties:
      href:
        type: string
  errors:
    type: object
    properties:
      errors:
        type: array
        items:
          type: object
          properties:
            code:
              type: string
            errorcode:
              type: string
            logref:
              type: string
            message:
              type: string
          example:
            code: assetmngmnt.code
            errorcode: assetmngmnt.errorcode
            logref: c27a28b6eb16b507fabc11e75da8b4ce
            message: Some meaningful message about the problems origin
  ETag:
    type: integer
    description: incremental counter for optimistic locking
    example: 1
  BillboardResource:
    type: object
    properties:
      self:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to the billboard url
      aspectTypes:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to aspect-types resource
      assetTypes:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to asset-types resource
      assets:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to assets resource
      files:
        type: object
        properties:
          href:
            type: string
            format: uri
            description: Link to files resource
  AssetTypeListResource:
    type: object
    properties:
      _embedded:
        type: object
        properties:
          assetTypes:
            type: array
            items:
              $ref: '#/definitions/AssetTypeResource'
      page:
        $ref: '#/definitions/Page'
      _links:
        $ref: '#/definitions/PagingLinks'
  AspectTypeListResource:
    type: object
    properties:
      _embedded:
        type: object
        properties:
          aspectTypes:
            type: array
            items:
              $ref: '#/definitions/AspectTypeResource'
      page:
        $ref: '#/definitions/Page'
      _links:
        $ref: '#/definitions/PagingLinks'
  AssetListResource:
    type: object
    properties:
      _embedded:
        type: object
        properties:
          assets:
            type: array
            items:
              $ref: '#/definitions/AssetResource'
      page:
        $ref: '#/definitions/Page'
      _links:
        $ref: '#/definitions/PagingLinks'
  VariableListResource:
    type: object
    properties:
      _embedded:
        type: object
        properties:
          variables:
            type: array
            items:
              $ref: '#/definitions/VariableDefinition'
      page:
        $ref: '#/definitions/Page'
      _links:
        $ref: '#/definitions/PagingLinks'
  AspectListResource:
    type: object
    properties:
      _embedded:
        type: object
        properties:
          aspects:
            type: array
            items:
              $ref: '#/definitions/AspectResource'
      page:
        $ref: '#/definitions/Page'
      _links:
        $ref: '#/definitions/PagingLinks'
  FileMetadataListResource:
    type: object
    properties:
      _embedded:
        type: object
        properties:
          files:
            type: array
            items:
              $ref: '#/definitions/FileMetadataResource'
      page:
        $ref: '#/definitions/Page'
      _links:
        $ref: '#/definitions/PagingLinks'
  AssetModelLock:
    type: object
    properties:
      enabled:
        $ref: '#/definitions/enabled'
      jobs:
        $ref: '#/definitions/jobs'
  ModelLock:
    type: object
    properties:
      enabled:
        $ref: '#/definitions/enabled'


parameters:
  TypeId:
    name: id
    in: path
    type: string
    minLength: 1
    maxLength: 128
    required: true
    pattern: '[A-Za-z0-9_]{1,8}\.[A-Za-z0-9_]+'
    description: >-
      The type's id is a unique identifier. The id's length must be between 1
      and 128 characters and matches the following symbols "A-Z", "a-z", "0-9",
      "_" and "." beginning with the tenant prefix what has a maximum of 8
      characters. (e.g . ten_pref.type_id)
  uniqueId:
    name: id
    in: path
    type: string
    pattern: '[0-9A-F]{32}'
    required: true
    description: Unique identifier
  fileKey:
    name: key
    in: path
    type: string
    pattern: '[\w]+'
    required: true
    description: Keyword for the file to be assigned to an asset or asset type.
  fileId:
    name: fileId
    in: path
    type: string
    pattern: '[0-9A-F]{32}'
    required: true
    description: Unique identifier of the file.
  page:
    name: page
    in: query
    type: integer
    description: Specifies the requested page index
  size:
    name: size
    in: query
    type: integer
    description: Specifies the number of elements in a page
  sort:
    name: sort
    in: query
    type: string
    description: Specifies the ordering of returned elements
  filter:
    name: filter
    in: query
    type: string
    description: Specifies the additional filtering criteria
  ifNoneMatch:
    name: If-None-Match
    in: header
    type: string
    description: ETag hash of previous request to allow caching
  ifNoneMatchStar:
    name: If-None-Match
    in: header
    type: string
    description: Set ifNoneMatch header to "*" for ensuring create request
  ifMatch:
    name: If-Match
    in: header
    type: string
    description: |
      Last known version to facilitate optimistic locking.
      *Required for modification.
  ifMatchMandatory:
    name: If-Match
    in: header
    type: string
    required: true
    description: Last known version to facilitate optimistic locking
  ifMatchVariable:
    name: If-Match
    in: header
    type: string
    required: true
    description: Last known version of asset type to facilitate optimistic locking. Etag from asset type response to be used.
  exploded:
    name: exploded
    in: query
    type: boolean
    description: >-
      Specifies if the asset type should include all of it's inherited variables
      and aspects. Default is false.
  includeShared:
    name: includeShared
    in: query
    type: boolean
    default: false
    description: >-
      Specifies if the operation should take into account shared (received) assets, aspects and asset types.
      Received resources are not visible in case includeShared=false.
      For query operations, received resources are not returned. Endpoints addressing individual resources respond with 404.
      In case received resources are referenced in a request parameter or property, they are treated as not existing.
  basicFieldsOnly:
    name: basicFieldsOnly
    in: query
    type: boolean
    default: false
    description: >-
      Specifies if the assets should include all of it's inherited variables and aspects from assettype and aspecttype.
