openapi: 3.1.0
info:
  title: Cozify OneAPI
  version: '3.0'
  termsOfService: https://en.cozify.fi/pages/privacy-policy
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  description: |-
    This is [OpenAPI specification](./one-3.0.yaml) for Cozify ONE platform.
    ### Terminology
    If you are new to Cozify Services, there are some terms you might not be familiar with.
    * **resource** - A manageable item that is available through platform. Hubs, Devices and Sites are examples of resources. Resource groups, subscriptions and tags are also examples of resources. * **resource group** - A container that holds related resources for an platform solution. The resource group includes those resources that you want to manage as a group. You decide which resources belong in a resource group based on what makes the most sense for your organization. * **resource provider** - A service that supplies platform resources. For example, a common resource provider is `Cozify.Site`, which supplies the structural management of site (aka. Buildings) resource. `Cozify.DeviceRegister` is another common resource provider.
    ### Receiving events from server using SignalR In addition to the REST endpoints described here, there is also SignalR hub for streaming device events and managing event subscriptions at `/hub/v1` endpoint. See the following page for more information about SignalR streams and how to use them with a .NET/JavaScript/Java client: [https://learn.microsoft.com/en-us/aspnet/core/signalr/streaming](https://learn.microsoft.com/en-us/aspnet/core/signalr/streaming)
    1. In order to be able to receive events from the hub, **you must open the event stream**, otherwise no events will be delivered regardless of subscriptions: - The device events stream name is `DeviceEventsStream`
      - The event type `DeviceEvent` is defined in this OpenApi document
    - For instructions how to use the server-to-client streaming sections [in this article](https://learn.microsoft.com/en-us/aspnet/core/signalr/streaming)
    2. To manage event subscriptions there are the following methods: - `DeviceEventsSubscribeAll(string deviceRegisterId)`
      - Subscribe to events from **all** devices in the register
    - `DeviceEventsUnsubscribeAll(string deviceRegisterId)`
      - Unsubscribe from **all** device events from the register
    - `DeviceEventsSubscribe(SubscribeDeviceEvents subscribeRequest)`
      - Subscribe to events from specific devices in the register
      - The `SubscribeDeviceEvents` type is defined in this OpenApi document.
      - **WARNING:** If previously subscribed to **all** events from the same register, this does not change anything; You will still receive events from all devices
    - `DeviceEventsUnsubscribe(UnsubscribeDeviceEvents unsubscribeRequest)`
      - Unsubscribe from specific devices from the register
      - The `UnsubscribeDeviceEvents` type is defined in this OpenApi document.
      - **WARNING:** If previously subscribed to **all** events from the same register, this does not change anything; You will still receive events from all devices
        - Use `DeviceEventsUnsubscribeAll` instead in this case

    ### Note > Cozify will only support Transport Layer Security (TLS) 1.2 or later.
  contact:
    email: support@cozify.fi
servers:
  - url: https://one.cozify.io
security:
  - Bearer: []
tags:
  - name: DeviceRegister
    description: Operations for managing device registers, such as executing commands on device registers and querying device register states.
  - name: Graph
    description: Cozify Graph is the gateway to data and intelligence in Cozify One.
  - name: Hub
    description: Operations related to the Cozify Hub, including command execution and querying the state of the hub and its connected devices.
  - name: Hubs
    description: Operations related to the Cozify Hubs services, including command execution and querying the state of the fleet.
paths:
  /graph/query:
    post:
      operationId: Query
      summary: Query
      description: Allows the execution of a specific query.
      tags:
        - Graph
      requestBody:
        description: Request object for query.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
  /graph/command:
    put:
      operationId: Command
      summary: Command
      description: Allows the execution of a specific command.
      tags:
        - Graph
      requestBody:
        description: Request object for command.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CommandRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
  /Providers/Cozify.Hub/{hubId}/Command:
    put:
      operationId: HubCommand
      summary: HubCommand
      deprecated: true
      description: Deprecated. Use /graph/command with migrated hub Graph commands instead.
      tags:
        - Hub
      parameters:
        - $ref: '#/components/parameters/HubId'
      requestBody:
        description: Request object for command.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HubCommandRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubCommandResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
  /Providers/Cozify.Hub/{hubId}/Query:
    post:
      operationId: HubQuery
      summary: HubQuery
      deprecated: true
      description: Deprecated. Use /graph/query with migrated hub Graph queries instead.
      tags:
        - Hub
      parameters:
        - $ref: '#/components/parameters/HubId'
      requestBody:
        description: Request object for query.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HubQueryRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubQueryResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
  /Providers/Cozify.Hubs/Query:
    post:
      operationId: HubsQuery
      summary: HubsQuery
      description: Allows the execution of a specific query against a Cozify Hubs services. This operation can be used to retrieve the state of fleets and the Hubs themselves.
      tags:
        - Hubs
      requestBody:
        description: Request object for query.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/HubsQueryRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HubsQueryResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
  /Providers/Cozify.DeviceRegister/{deviceRegisterId}/Command:
    put:
      operationId: DeviceRegisterCommand
      summary: DeviceRegisterCommand
      description: Allows the execution of a specific command against a device register. This operation can be used to mutate the state of devices and the device register itself.
      tags:
        - DeviceRegister
      parameters:
        - $ref: '#/components/parameters/DeviceRegisterId'
      requestBody:
        description: Request object for command.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceRegisterCommandRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceRegisterCommandResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
  /Providers/Cozify.DeviceRegister/{deviceRegisterId}/Query:
    post:
      operationId: DeviceRegisterQuery
      summary: DeviceRegisterQuery
      description: Allows the execution of a specific query against a device register. This operation is used to retrieve the state of devices and the device register itself.
      tags:
        - DeviceRegister
      parameters:
        - $ref: '#/components/parameters/DeviceRegisterId'
      requestBody:
        description: Request object for query.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeviceRegisterQueryRequest'
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeviceRegisterQueryResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        default:
          $ref: '#/components/responses/Problem'
components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    Query:
      type: object
      description: Base type for queries.
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          GetHubMetadataQuery: '#/components/schemas/GetHubMetadataQuery'
          GetHubUserAssignmentQuery: '#/components/schemas/GetHubUserAssignmentQuery'
          ListHubUserAssignmentsQuery: '#/components/schemas/ListHubUserAssignmentsQuery'
          GetDeviceRegisterKeyVaultQuery: '#/components/schemas/GetDeviceRegisterKeyVaultQuery'
          GetTenantKeyVaultQuery: '#/components/schemas/GetTenantKeyVaultQuery'
          ListDeviceRegisterKeyVaultQuery: '#/components/schemas/ListDeviceRegisterKeyVaultQuery'
          ListTenantKeyVaultQuery: '#/components/schemas/ListTenantKeyVaultQuery'
          GetSubscriptionQuery: '#/components/schemas/GetSubscriptionQuery'
          ListResourceGroupsQuery: '#/components/schemas/ListResourceGroupsQuery'
          ListResourcesQuery: '#/components/schemas/ListResourcesQuery'
          ListSubscriptionsQuery: '#/components/schemas/ListSubscriptionsQuery'
          GetCurrentTenantQuery: '#/components/schemas/GetCurrentTenantQuery'
          ListTenantsQuery: '#/components/schemas/ListTenantsQuery'
      required:
        - type
    HubId:
      type: string
      description: The identifier of the hub.
      format: uuid
    GetHubMetadataQuery:
      type: object
      description: Retrieve metadata for a specific hub.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
      required:
        - hubId
    UserIdProperty:
      description: The identifier of the user.
      type: string
      format: uuid
      example: 3ee5d62c-fa38-42a0-a5ac-0c4b315d75fb
    GetHubUserAssignmentQuery:
      type: object
      description: Retrieve a specific hub user assignment.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
        userId:
          $ref: '#/components/schemas/UserIdProperty'
      required:
        - hubId
        - userId
    QuerySkip:
      type: integer
      description: Specifies the number of items to skip for query.
      format: int64
      minimum: 0
      example: 0
    QueryLimit:
      type: integer
      description: Specifies the maximum number of items to include in query result.
      format: int64
      minimum: 1
      maximum: 2000
      example: 10
    ListHubUserAssignmentsQueryFilter:
      type: object
      description: Base type for filters used when listing hub user assignments.
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the filter type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          ListHubUserAssignmentsQueryKeywordFilter: '#/components/schemas/ListHubUserAssignmentsQueryKeywordFilter'
      required:
        - type
    ListHubUserAssignmentsQueryKeywordFilter:
      type: object
      description: Filter hub user assignments using a keyword matched against email, nickname, or phone number.
      allOf:
        - $ref: '#/components/schemas/ListHubUserAssignmentsQueryFilter'
      additionalProperties: false
      properties:
        keyword:
          type: string
          minLength: 2
          description: Keyword matched against email, nickname, and phone number.
      required:
        - keyword
    ListHubUserAssignmentsQuery:
      type: object
      description: List hub user assignments.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
        filters:
          type: array
          description: Optional filters for refining the query.
          items:
            $ref: '#/components/schemas/ListHubUserAssignmentsQueryFilter'
      required:
        - hubId
        - skip
        - limit
    DeviceRegisterId:
      type: string
      description: The identifier of the device register.
    KeyId:
      type: string
      description: Identifier of the key vault entry.
      example: dd8993e6d9564957aba55e3cdb0b4498
    GetDeviceRegisterKeyVaultQuery:
      type: object
      description: Query to retrieve a specific device register key vault entry based on the provided device register identifier and key identifier.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        keyId:
          $ref: '#/components/schemas/KeyId'
      required:
        - deviceRegisterId
        - keyId
    GetTenantKeyVaultQuery:
      type: object
      description: Query to retrieve a specific tenant key vault entry based on the provided key identifier.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        keyId:
          $ref: '#/components/schemas/KeyId'
      required:
        - keyId
    ListDeviceRegisterKeyVaultQuery:
      type: object
      description: Query to retrieve a list of device register key vault entries.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
      required:
        - deviceRegisterId
        - skip
        - limit
    ListTenantKeyVaultQuery:
      type: object
      description: Query to retrieve a list of tenant key vault entries.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
      required:
        - skip
        - limit
    SubscriptionId:
      type: string
      description: The identifier of the subscription.
      format: uuid
      example: dd8993e6-d956-4957-aba5-5e3cdb0b4498
    GetSubscriptionQuery:
      type: object
      description: Retrieve a specific subscription.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
      required:
        - subscriptionId
    ListResourceGroupsQuery:
      type: object
      description: Retrieve a list of resource groups for a subscription.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
      required:
        - subscriptionId
        - skip
        - limit
    ListResourcesQuery:
      type: object
      description: Retrieve a list of resources for a subscription.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
        resourceGroup:
          type: string
          description: Name of the resource group.
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
      required:
        - subscriptionId
        - resourceGroup
        - skip
        - limit
    ListSubscriptionsQueryFilter:
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          ListSubscriptionsQueryTenantIdFilter: '#/components/schemas/ListSubscriptionsQueryTenantIdFilter'
      required:
        - type
    TenantId:
      type: string
      description: The identifier of the tenant.
      format: uuid
      example: dd8993e6-d956-4957-aba5-5e3cdb0b4498
    ListSubscriptionsQueryTenantIdFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListSubscriptionsQueryFilter'
      additionalProperties: false
      properties:
        tenantId:
          $ref: '#/components/schemas/TenantId'
      required:
        - tenantId
    ListSubscriptionsQuery:
      type: object
      description: Retrieve a list of subscriptions.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
        filters:
          description: Filters to apply to the query.
          type: array
          items:
            $ref: '#/components/schemas/ListSubscriptionsQueryFilter'
      required:
        - skip
        - limit
    GetCurrentTenantQuery:
      type: object
      description: Query to retrieve the current tenant.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
    ListTenantsQuery:
      type: object
      description: Retrieve a list of tenants in the system.
      allOf:
        - $ref: '#/components/schemas/Query'
      additionalProperties: false
      properties:
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
      required:
        - skip
        - limit
    QueryRequest:
      type: object
      description: Request object for query.
      additionalProperties: false
      properties:
        query:
          $ref: '#/components/schemas/Query'
      required:
        - query
    Problem:
      type: object
      additionalProperties: true
      minProperties: 1
      description: The Problem Details JSON Object [[RFC7807](https://tools.ietf.org/html/rfc7807)].
      properties:
        type:
          type: string
          description: A URI reference [[RFC3986](https://tools.ietf.org/html/rfc3986)] that identifies the problem type. It should provide human-readable documentation for the problem type. When this member is not present, its value is assumed to be "about:blank".
          format: uri
        title:
          type: string
          description: A short, human-readable summary of the problem type. It SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
        status:
          type: integer
          description: The HTTP status code.
          minimum: 400
          maximum: 599
        detail:
          type: string
          description: A human-readable explanation specific to this occurrence of the problem.
        instance:
          type: string
          description: A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.
    QueryResult:
      type: object
      description: Base type for query results.
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          GetHubMetadataQueryResult: '#/components/schemas/GetHubMetadataQueryResult'
          GetHubUserAssignmentQueryResult: '#/components/schemas/GetHubUserAssignmentQueryResult'
          ListHubUserAssignmentsQueryResult: '#/components/schemas/ListHubUserAssignmentsQueryResult'
          GetDeviceRegisterKeyVaultQueryResult: '#/components/schemas/GetDeviceRegisterKeyVaultQueryResult'
          GetTenantKeyVaultQueryResult: '#/components/schemas/GetTenantKeyVaultQueryResult'
          ListDeviceRegisterKeyVaultQueryResult: '#/components/schemas/ListDeviceRegisterKeyVaultQueryResult'
          ListTenantKeyVaultQueryResult: '#/components/schemas/ListTenantKeyVaultQueryResult'
          GetSubscriptionQueryResult: '#/components/schemas/GetSubscriptionQueryResult'
          ListResourceGroupsQueryResult: '#/components/schemas/ListResourceGroupsQueryResult'
          ListResourcesQueryResult: '#/components/schemas/ListResourcesQueryResult'
          ListSubscriptionsQueryResult: '#/components/schemas/ListSubscriptionsQueryResult'
          GetCurrentTenantQueryResult: '#/components/schemas/GetCurrentTenantQueryResult'
          ListTenantsQueryResult: '#/components/schemas/ListTenantsQueryResult'
      required:
        - type
    HubIdProperty:
      description: The identifier of the Cozify Hub.
      type: string
      format: uuid
      example: 3ee5d62c-fa38-42a0-a5ac-0c4b315d75fb
      deprecated: true
    HubMetadata:
      description: Hub metadata information.
      type: object
      additionalProperties: false
      properties:
        connected:
          description: Whether the Hub is connected to the Cozify services.
          type: boolean
          example: true
        features:
          description: List of features enabled on Hub.
          type: array
          items:
            type: integer
          example:
            - 3
            - 6
            - 8
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
        name:
          description: User given name of the Hub.
          type: string
          example: Hub 1234
        state:
          description: |-
            State of the Hub.
             * **factory_new**: Factory new hub, no owner.
             * **claimed**: Claimed by a user, has an owner.
          type: string
          enum:
            - factory_new
            - claimed
          example: claimed
        version:
          description: Version of the software.
          type: string
          example: '1.14'
      required:
        - version
        - state
        - hubId
        - features
        - connected
    GetHubMetadataQueryResult:
      type: object
      description: Result of retrieving hub metadata.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/HubMetadata'
    HubUserRole:
      description: |-
        Defines the role of a user in the Cozify Hub. Each role has different levels
        of access and privileges:
          * **Anonymous**: Minimal access, typically for unauthenticated users. Limited to basic, non-personalized interactions.
          * **Guest**: Basic access to view certain resources without making changes. Suitable for temporary or limited access.
          * **RemoteGuest**: Similar to Guest, but specifically for remote access. Intended for users needing to view resources from a remote location.
          * **User**: Standard access with abilities to perform common tasks and operations. This is the default role for most authenticated users.
          * **Admin**: Elevated privileges including management and configuration capabilities. Admins can alter settings and manage other users.
          * **Owner**: Highest level of access, with full control over all settings and operations within the Cozify Hub. The Owner role typically has all permissions.
      type: string
      enum:
        - Anonymous
        - Guest
        - RemoteGuest
        - User
        - Admin
        - Owner
    HubUserAssignment:
      description: Defines the assignment of a user to a Cozify Hub.
      type: object
      additionalProperties: false
      properties:
        userId:
          description: The identifier of the user.
          type: string
          format: uuid
        email:
          description: The email address of the user.
          type: string
          format: email
        role:
          $ref: '#/components/schemas/HubUserRole'
      required:
        - userId
        - email
        - role
    GetHubUserAssignmentQueryResult:
      type: object
      description: Result of retrieving a single hub user assignment.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/HubUserAssignment'
    QueryTotalCount:
      type: integer
      description: Provides the total number of items available in query result.
      format: int64
      minimum: 0
      default: 0
      example: 2000
    ListHubUserAssignmentsQueryResult:
      type: object
      description: Result of listing hub user assignments.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of hub user assignments matching the query criteria.
          items:
            $ref: '#/components/schemas/HubUserAssignment'
    DisplayName:
      type: string
      description: Human-readable identifier intended to provide a clear and concise name.
      maxLength: 64
      pattern: ^([a-zA-Z0-9_.\s\u0080-\uFFFF]+)$
      example: Brown Fox
    Tags:
      type: object
      description: |
        A flexible container for key-value pairs, where both keys and values are strings.
        This can be used for adding metadata, labels, or other types of tagging information.
      additionalProperties:
        type: string
    KeyVaultEntry:
      type: object
      description: Represents a key vault entry, containing the key identifier and associated secrets.
      additionalProperties: false
      properties:
        keyId:
          $ref: '#/components/schemas/KeyId'
        primary:
          type: string
          description: Primary secret.
        secondary:
          type: string
          description: Secondary secret accepted during key rotation.
        displayName:
          $ref: '#/components/schemas/DisplayName'
        tags:
          $ref: '#/components/schemas/Tags'
        notBefore:
          type: string
          format: date-time
          description: The time before which the primary key is not valid. If not specified, the key becomes valid immediately.
      required:
        - keyId
        - primary
        - notBefore
    GetDeviceRegisterKeyVaultQueryResult:
      type: object
      description: Result of querying a device register key vault entry, containing the key identifier and associated secrets.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        entry:
          $ref: '#/components/schemas/KeyVaultEntry'
    GetTenantKeyVaultQueryResult:
      type: object
      description: Result of querying a tenant key vault entry, containing the key identifier and associated secrets.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/KeyVaultEntry'
    ListDeviceRegisterKeyVaultQueryResult:
      type: object
      description: Result of querying a list of device register key vault entries.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of key vault entries matching the query criteria.
          items:
            $ref: '#/components/schemas/KeyVaultEntry'
    ListTenantKeyVaultQueryResult:
      type: object
      description: Result of querying a list of tenant key vault entries.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of key vault entries matching the query criteria.
          items:
            $ref: '#/components/schemas/KeyVaultEntry'
    CreatedAt:
      type: string
      description: Date and time when the resource was created.
      format: date-time
    CreatedBy:
      type: string
      description: Identifier of the creator of the resource.
      maxLength: 50
      example: Jacob Brave
    ModifiedAt:
      type: string
      description: Date and time when the resource was last modified.
      format: date-time
    ModifiedBy:
      type: string
      description: Identifier that last modified the resource.
      maxLength: 50
      example: Jacob Braver
    SubscriptionEntry:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          description: Resource identifier of the subscription.
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        tags:
          $ref: '#/components/schemas/Tags'
        managedByTenants:
          type: array
          description: A list of tenants that are managing the subscription.
          items:
            $ref: '#/components/schemas/TenantId'
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        createdBy:
          $ref: '#/components/schemas/CreatedBy'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
        modifiedBy:
          $ref: '#/components/schemas/ModifiedBy'
      required:
        - id
        - subscriptionId
        - displayName
        - tags
        - managedByTenants
        - createdAt
        - createdBy
        - modifiedAt
        - modifiedBy
    GetSubscriptionQueryResult:
      type: object
      description: Result of a query to retrieve a list of subscriptions.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/SubscriptionEntry'
    ResourceGroupEntry:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          description: Resource identifier of the resource group.
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
        name:
          type: string
          description: Name of the resource group.
        location:
          type: string
          description: Location of the resource group.
        tags:
          $ref: '#/components/schemas/Tags'
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        createdBy:
          $ref: '#/components/schemas/CreatedBy'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
        modifiedBy:
          $ref: '#/components/schemas/ModifiedBy'
      required:
        - id
        - subscriptionId
        - name
        - tags
        - createdAt
        - createdBy
        - modifiedAt
        - modifiedBy
    ListResourceGroupsQueryResult:
      type: object
      description: Result of a query to retrieve a list of resource groups of a subscription.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of resource groups matching the query criteria.
          items:
            $ref: '#/components/schemas/ResourceGroupEntry'
    ResourceEntry:
      type: object
      additionalProperties: false
      properties:
        id:
          type: string
          description: Resource identifier of the resource.
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
        resourceGroup:
          type: string
          description: Name of the resource group.
        name:
          type: string
          description: Name of the resource.
        displayName:
          $ref: '#/components/schemas/DisplayName'
        location:
          type: string
          description: Location of the resource.
        tags:
          $ref: '#/components/schemas/Tags'
        resourceProvider:
          type: string
          description: Provider of the resource.
        properties:
          type: object
          description: Additional properties of the resource.
          additionalProperties:
            type: string
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        createdBy:
          $ref: '#/components/schemas/CreatedBy'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
        modifiedBy:
          $ref: '#/components/schemas/ModifiedBy'
      required:
        - id
        - subscriptionId
        - resourceGroup
        - name
        - displayName
        - location
        - tags
        - resourceProvider
        - properties
        - createdAt
        - createdBy
        - modifiedAt
        - modifiedBy
    ListResourcesQueryResult:
      type: object
      description: Result of a query to retrieve a list of resources of a subscription.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of resources matching the query criteria.
          items:
            $ref: '#/components/schemas/ResourceEntry'
    ListSubscriptionsQueryResult:
      type: object
      description: Result of a query to retrieve a list of subscriptions.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of subscriptions matching the query criteria.
          items:
            $ref: '#/components/schemas/SubscriptionEntry'
    TenantEntry:
      type: object
      description: Summary about your tenant that is publicly displayed to users in other tenants.
      additionalProperties: false
      properties:
        id:
          type: string
          description: Resource identifier of the tenant.
        tenantId:
          $ref: '#/components/schemas/TenantId'
        displayName:
          $ref: '#/components/schemas/DisplayName'
        locations:
          type: array
          description: List of available locations for the tenant.
          items:
            type: string
        tags:
          $ref: '#/components/schemas/Tags'
        createdBy:
          $ref: '#/components/schemas/CreatedBy'
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        modifiedBy:
          $ref: '#/components/schemas/ModifiedBy'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
      required:
        - id
        - tenantId
        - displayName
        - locations
        - createdBy
        - createdAt
        - modifiedBy
        - modifiedAt
    GetCurrentTenantQueryResult:
      type: object
      description: Result of the GetCurrentTenantQuery.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/TenantEntry'
    ListTenantsQueryResult:
      type: object
      description: Result of a query to retrieve a list of tenants in the system.
      allOf:
        - $ref: '#/components/schemas/QueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryTotalCount'
        entries:
          type: array
          description: A list of tenants matching the query criteria.
          items:
            $ref: '#/components/schemas/TenantEntry'
    GraphCode:
      description: |-
        Error code for the result of command or query.
        * **E_UNKNOWN**: Unknown error.
        * **E_NOT_FOUND**: The requested resource was not found.
        * **E_SERVICE_ERROR**: Service encountered an error.
        * **E_INVALID_DATA**: The data is invalid.
        * **E_UNPROCESSABLE_CONTENT**: The content was unprocessable.
        * **E_ACCESS_DENIED**: Access is denied.
        * **E_NOT_SUPPORTED**: Operation is not supported.
        * **E_CONFLICT**: Operation conflicts with existing data.
        * **E_OPERATION_CANCELLED**: Operation was cancelled.
        * **E_TIMEOUT**: Operation timed out.
        * **E_NO_CONNECTION**: No connection to dependency.
        * **E_TOO_MANY_REQUESTS**: Too many requests.
      type: string
      enum:
        - E_UNKNOWN
        - E_NOT_FOUND
        - E_SERVICE_ERROR
        - E_INVALID_DATA
        - E_UNPROCESSABLE_CONTENT
        - E_ACCESS_DENIED
        - E_NOT_SUPPORTED
        - E_CONFLICT
        - E_OPERATION_CANCELLED
        - E_TIMEOUT
        - E_NO_CONNECTION
        - E_TOO_MANY_REQUESTS
    GraphError:
      description: Error object for the results of commands and queries.
      type: object
      additionalProperties: false
      properties:
        code:
          $ref: '#/components/schemas/GraphCode'
        message:
          description: A human-readable message describing the error.
          type: string
          minLength: 1
        details:
          description: Additional details about the error.
          type: object
          additionalProperties:
            type: string
        errors:
          description: Nested errors if request contained multiple operations or validation errors.
          type: array
          items:
            $ref: '#/components/schemas/GraphError'
      required:
        - code
    QueryResponse:
      type: object
      description: Response object for query result.
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/QueryResult'
      required:
        - result
    Command:
      type: object
      description: Base type commands.
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          CreateHubUserAssignmentCommand: '#/components/schemas/CreateHubUserAssignmentCommand'
          DeleteHubUserAssignmentCommand: '#/components/schemas/DeleteHubUserAssignmentCommand'
          RebootHubDeviceCommand: '#/components/schemas/RebootHubDeviceCommand'
          RestartHubDeviceCommand: '#/components/schemas/RestartHubDeviceCommand'
          CreateDeviceRegisterKeyVaultCommand: '#/components/schemas/CreateDeviceRegisterKeyVaultCommand'
          CreateTenantKeyVaultCommand: '#/components/schemas/CreateTenantKeyVaultCommand'
          RevokeDeviceRegisterKeyVaultCommand: '#/components/schemas/RevokeDeviceRegisterKeyVaultCommand'
          RevokeTenantKeyVaultCommand: '#/components/schemas/RevokeTenantKeyVaultCommand'
          CreateSubscriptionCommand: '#/components/schemas/CreateSubscriptionCommand'
          DeleteSubscriptionCommand: '#/components/schemas/DeleteSubscriptionCommand'
          UpdateSubscriptionCommand: '#/components/schemas/UpdateSubscriptionCommand'
          CreateTenantCommand: '#/components/schemas/CreateTenantCommand'
          DeleteTenantCommand: '#/components/schemas/DeleteTenantCommand'
          SetCurrentTenantCommand: '#/components/schemas/SetCurrentTenantCommand'
          UpdateTenantCommand: '#/components/schemas/UpdateTenantCommand'
      required:
        - type
    UserEmailProperty:
      description: Email of the user.
      type: string
      format: email
      example: some.user@example.com
    CreateHubUserAssignmentCommand:
      type: object
      description: Command to invite or create a user assignment for a hub.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
        email:
          $ref: '#/components/schemas/UserEmailProperty'
        role:
          $ref: '#/components/schemas/HubUserRole'
        skipCreate:
          type: boolean
          description: Determines whether the user should be automatically created if needed.
          default: false
      required:
        - hubId
        - email
        - role
    DeleteHubUserAssignmentCommand:
      type: object
      description: Command to revoke a user assignment from a hub.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
        userId:
          $ref: '#/components/schemas/UserIdProperty'
        email:
          $ref: '#/components/schemas/UserEmailProperty'
      required:
        - hubId
    RebootHubDeviceCommand:
      type: object
      description: Command to reboot a hub.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
      required:
        - hubId
    RestartHubDeviceCommand:
      type: object
      description: Command to restart a hub.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubId'
      required:
        - hubId
    CreateDeviceRegisterKeyVaultCommand:
      type: object
      description: Command to add a new device register key and rotate existing key material.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        keyId:
          $ref: '#/components/schemas/KeyId'
        secret:
          type: string
          description: New key material that becomes the primary key.
        displayName:
          $ref: '#/components/schemas/DisplayName'
        tags:
          $ref: '#/components/schemas/Tags'
        notBefore:
          type: string
          format: date-time
          description: The time before which the primary key is not valid. If not specified, the key becomes valid immediately.
      required:
        - deviceRegisterId
        - keyId
        - secret
    CreateTenantKeyVaultCommand:
      type: object
      description: Command to create a tenant key vault entry.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        keyId:
          $ref: '#/components/schemas/KeyId'
        secret:
          type: string
          description: Secret associated with the key vault entry.
        displayName:
          $ref: '#/components/schemas/DisplayName'
        tags:
          $ref: '#/components/schemas/Tags'
        notBefore:
          type: string
          format: date-time
          description: The time before which the primary key is not valid. If not specified, the key becomes valid immediately.
      required:
        - keyId
        - secret
    RevokeDeviceRegisterKeyVaultCommand:
      type: object
      description: Command to revoke a device register key and rotate existing key material.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        keyId:
          $ref: '#/components/schemas/KeyId'
      required:
        - deviceRegisterId
        - keyId
    RevokeTenantKeyVaultCommand:
      type: object
      description: Command to delete a tenant key vault entry.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        keyId:
          $ref: '#/components/schemas/KeyId'
      required:
        - keyId
    CreateSubscriptionCommand:
      type: object
      description: Command to create a subscription.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        displayName:
          $ref: '#/components/schemas/DisplayName'
        tags:
          $ref: '#/components/schemas/Tags'
      required:
        - displayName
    DeleteSubscriptionCommand:
      type: object
      description: Command to delete a subscription.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        subscriptionId:
          $ref: '#/components/schemas/SubscriptionId'
      required:
        - subscriptionId
    UpdateSubscriptionCommand:
      type: object
      description: Command to update a subscription.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        subscriptionId:
          description: Targeted subscription with the given subscriptionId will be updated.
          $ref: '#/components/schemas/SubscriptionId'
        displayName:
          description: New display name for the subscription (leave empty to keep the same).
          $ref: '#/components/schemas/DisplayName'
        tags:
          description: New tags for the subscription (leave empty to keep the same).
          $ref: '#/components/schemas/Tags'
      required:
        - subscriptionId
    CreateTenantCommand:
      type: object
      description: Command to create a tenant, which represents an organizational unit or a group of users within a system.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        displayName:
          $ref: '#/components/schemas/DisplayName'
        tags:
          $ref: '#/components/schemas/Tags'
      required:
        - displayName
    DeleteTenantCommand:
      type: object
      description: Command to delete a tenant.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        tenantId:
          description: Targeted tenant with the given tenantId will be deleted.
          $ref: '#/components/schemas/TenantId'
      required:
        - tenantId
    SetCurrentTenantCommand:
      type: object
      description: Command to set the current tenant. This command is used to switch the context to a specific tenant for subsequent operations.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        tenantId:
          description: The identifier of the tenant to set as the current tenant.
          $ref: '#/components/schemas/TenantId'
      required:
        - tenantId
    UpdateTenantCommand:
      type: object
      description: Command to update a tenant.
      allOf:
        - $ref: '#/components/schemas/Command'
      additionalProperties: false
      properties:
        tenantId:
          description: Targeted tenant with the given tenantId will be updated (leave empty to update the tenant of the current context).
          $ref: '#/components/schemas/TenantId'
        displayName:
          description: New display name for the tenant (leave empty to keep the same).
          $ref: '#/components/schemas/DisplayName'
        tags:
          description: New tags for the tenant (leave empty to keep the same).
          $ref: '#/components/schemas/Tags'
    CommandRequest:
      type: object
      description: Request object for command.
      additionalProperties: false
      properties:
        command:
          $ref: '#/components/schemas/Command'
      required:
        - command
    CommandResult:
      type: object
      description: Base type for all hub command results.
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          CreateHubUserAssignmentCommandResult: '#/components/schemas/CreateHubUserAssignmentCommandResult'
          DeleteHubUserAssignmentCommandResult: '#/components/schemas/DeleteHubUserAssignmentCommandResult'
          RebootHubDeviceCommandResult: '#/components/schemas/RebootHubDeviceCommandResult'
          RestartHubDeviceCommandResult: '#/components/schemas/RestartHubDeviceCommandResult'
          CreateDeviceRegisterKeyVaultCommandResult: '#/components/schemas/CreateDeviceRegisterKeyVaultCommandResult'
          CreateTenantKeyVaultCommandResult: '#/components/schemas/CreateTenantKeyVaultCommandResult'
          RevokeDeviceRegisterKeyVaultCommandResult: '#/components/schemas/RevokeDeviceRegisterKeyVaultCommandResult'
          RevokeTenantKeyVaultCommandResult: '#/components/schemas/RevokeTenantKeyVaultCommandResult'
          CreateSubscriptionCommandResult: '#/components/schemas/CreateSubscriptionCommandResult'
          DeleteSubscriptionCommandResult: '#/components/schemas/DeleteSubscriptionCommandResult'
          UpdateSubscriptionCommandResult: '#/components/schemas/UpdateSubscriptionCommandResult'
          CreateTenantCommandResult: '#/components/schemas/CreateTenantCommandResult'
          DeleteTenantCommandResult: '#/components/schemas/DeleteTenantCommandResult'
          SetCurrentTenantCommandResult: '#/components/schemas/SetCurrentTenantCommandResult'
          UpdateTenantCommandResult: '#/components/schemas/UpdateTenantCommandResult'
      required:
        - type
    CreateHubUserAssignmentCommandResult:
      type: object
      description: Result of creating a hub user assignment.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/HubUserAssignment'
    DeleteHubUserAssignmentCommandResult:
      type: object
      description: Result of deleting a hub user assignment.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    RebootHubDeviceCommandResult:
      type: object
      description: Result of rebooting a hub.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    RestartHubDeviceCommandResult:
      type: object
      description: Result of restarting a hub.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    CreateDeviceRegisterKeyVaultCommandResult:
      type: object
      description: Result of adding or rotating device register key material.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        deviceRegisterId:
          $ref: '#/components/schemas/DeviceRegisterId'
        entry:
          $ref: '#/components/schemas/KeyVaultEntry'
    CreateTenantKeyVaultCommandResult:
      type: object
      description: Result of the command to create a tenant key vault entry.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/KeyVaultEntry'
    RevokeDeviceRegisterKeyVaultCommandResult:
      type: object
      description: Result of revoking a device register key.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    RevokeTenantKeyVaultCommandResult:
      type: object
      description: Result of the command to delete a tenant key vault entry.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    CreateSubscriptionCommandResult:
      type: object
      description: Result of the CreateSubscriptionCommand.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/SubscriptionEntry'
    DeleteSubscriptionCommandResult:
      type: object
      description: Result of the DeleteSubscriptionCommand.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    UpdateSubscriptionCommandResult:
      type: object
      description: Result of the UpdateSubscriptionCommand.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/SubscriptionEntry'
    CreateTenantCommandResult:
      type: object
      description: Result of the command to create a tenant, containing the created tenant entry.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/TenantEntry'
    DeleteTenantCommandResult:
      type: object
      description: Result of the DeleteTenantCommand.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
    SetCurrentTenantCommandResult:
      type: object
      description: Result of the SetCurrentTenantCommand.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/TenantEntry'
    UpdateTenantCommandResult:
      type: object
      description: Result of the UpdateTenantCommand.
      allOf:
        - $ref: '#/components/schemas/CommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/TenantEntry'
    CommandResponse:
      type: object
      description: Response object for command result.
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/CommandResult'
      required:
        - result
    HubCommand:
      description: Deprecated. Use base Graph hub commands through /graph/command.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hub/InviteUserHubCommand: '#/components/schemas/InviteUserHubCommand'
          Cozify.Hub/RevokeUserHubCommand: '#/components/schemas/RevokeUserHubCommand'
          Cozify.Hub/RebootHubCommand: '#/components/schemas/RebootHubCommand'
          Cozify.Hub/RestartHubCommand: '#/components/schemas/RestartHubCommand'
      required:
        - type
    InviteUserHubCommand:
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommand'
      additionalProperties: false
      description: Deprecated. Use CreateHubUserAssignmentCommand through /graph/command.
      properties:
        email:
          description: The email address of the user to invite.
          type: string
          format: email
        role:
          $ref: '#/components/schemas/HubUserRole'
        skipCreate:
          description: |-
            Determines whether the user should be automatically created if needed.

            If this is set to **true**, the user must already exist.
          type: boolean
          default: false
      required:
        - email
        - role
    RevokeUserHubCommand:
      description: Deprecated. Use DeleteHubUserAssignmentCommand through /graph/command.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommand'
      additionalProperties: false
      properties:
        userId:
          $ref: '#/components/schemas/UserIdProperty'
        email:
          $ref: '#/components/schemas/UserEmailProperty'
    RebootHubCommand:
      description: Deprecated. Use RebootHubDeviceCommand through /graph/command.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommand'
      additionalProperties: false
    RestartHubCommand:
      description: Deprecated. Use RestartHubDeviceCommand through /graph/command.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommand'
      additionalProperties: false
    HubCommandRequest:
      description: Deprecated. Use Graph CommandRequest with migrated hub commands.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        command:
          $ref: '#/components/schemas/HubCommand'
      required:
        - command
    HubCommandResult:
      description: Deprecated. Use base Graph command results for hub operations.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hub/InviteUserHubCommandResult: '#/components/schemas/InviteUserHubCommandResult'
          Cozify.Hub/RevokeUserHubCommandResult: '#/components/schemas/RevokeUserHubCommandResult'
          Cozify.Hub/RebootHubCommandResult: '#/components/schemas/RebootHubCommandResult'
          Cozify.Hub/RestartHubCommandResult: '#/components/schemas/RestartHubCommandResult'
      required:
        - type
    InviteUserHubCommandResult:
      description: Result of command to invite a user to the Cozify Hub.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommandResult'
      additionalProperties: false
      properties:
        userAssignment:
          $ref: '#/components/schemas/HubUserAssignment'
    RevokeUserHubCommandResult:
      description: Result of command to revoke a user's access to the Cozify Hub.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommandResult'
      additionalProperties: false
    RebootHubCommandResult:
      description: Result of command to reboot the Cozify Hub.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommandResult'
      additionalProperties: false
    RestartHubCommandResult:
      description: Result of command to restart the Cozify Hub.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubCommandResult'
      additionalProperties: false
    HubCommandResponse:
      description: |
        Deprecated. Use Graph CommandResponse with migrated hub commands.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/HubCommandResult'
      required:
        - result
    HubQuery:
      description: Deprecated. Use base Graph hub queries through /graph/query.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hub/GetUserAssignmentHubQuery: '#/components/schemas/GetUserAssignmentHubQuery'
          Cozify.Hub/ListUserAssignmentsPagedHubQuery: '#/components/schemas/ListUserAssignmentsPagedHubQuery'
          Cozify.Hub/GetMetadataHubQuery: '#/components/schemas/GetMetadataHubQuery'
      required:
        - type
    GetUserAssignmentHubQuery:
      description: Deprecated. Use GetHubUserAssignmentQuery through /graph/query.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubQuery'
      additionalProperties: false
      properties:
        userId:
          description: The identifier of the user to get the assignment for.
          type: string
          format: uuid
      required:
        - userId
    QueryPageProperty:
      description: Specifies the page number of the result set.
      type: integer
      format: int32
      minimum: 1
      example: 1
    QueryPageSizeProperty:
      description: |-
        Determines the number of results to display per page.
        Adjusting this value can help balance the amount of data returned with performance considerations.
      type: integer
      format: int32
      minimum: 1
      maximum: 2000
      default: 100
      example: 100
    ListUserAssignmentsHubQueryFilter:
      description: Deprecated. Use ListHubUserAssignmentsQueryFilter through /graph/query.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/ListUserAssignmentsHubQuery/KeywordFilter: '#/components/schemas/ListUserAssignmentsHubQueryKeywordFilter'
      required:
        - type
    ListUserAssignmentsHubQueryKeywordFilter:
      description: Deprecated. Use ListHubUserAssignmentsQueryKeywordFilter through /graph/query.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/ListUserAssignmentsHubQueryFilter'
      additionalProperties: false
      properties:
        keyword:
          description: A keyword to filter the results by. The keyword is compared against the user's email address, nickname and phone number.
          type: string
          minLength: 2
      required:
        - keyword
    ListUserAssignmentsPagedHubQuery:
      description: Deprecated. Use ListHubUserAssignmentsQuery through /graph/query.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubQuery'
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/QueryPageProperty'
        pageSize:
          $ref: '#/components/schemas/QueryPageSizeProperty'
        filters:
          description: An optional array of filters that can be applied to refine the user assignments query. Each filter in the array should adhere to a specified filter schema, allowing for complex querying capabilities.
          type: array
          items:
            $ref: '#/components/schemas/ListUserAssignmentsHubQueryFilter'
      required:
        - page
        - pageSize
    GetMetadataHubQuery:
      description: Deprecated. Use GetHubMetadataQuery through /graph/query.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubQuery'
      additionalProperties: false
    HubQueryRequest:
      description: Deprecated. Use Graph QueryRequest with migrated hub queries.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        query:
          $ref: '#/components/schemas/HubQuery'
      required:
        - query
    HubQueryResult:
      description: Deprecated. Use base Graph query results for hub operations.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hub/GetUserAssignmentHubQueryResult: '#/components/schemas/GetUserAssignmentHubQueryResult'
          Cozify.Hub/ListUserAssignmentsPagedHubQueryResult: '#/components/schemas/ListUserAssignmentsPagedHubQueryResult'
          Cozify.Hub/GetMetadataHubQueryResult: '#/components/schemas/GetMetadataHubQueryResult'
      required:
        - type
    GetUserAssignmentHubQueryResult:
      description: Result of query to get a user assignment for a Cozify Hub.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubQueryResult'
      additionalProperties: false
      properties:
        userAssignment:
          $ref: '#/components/schemas/HubUserAssignment'
    QueryResultPageProperty:
      description: Indicates the current page number returned in this result.
      type: integer
      format: int32
      minimum: 0
      default: 0
      example: 1
    QueryResultPageSizeProperty:
      description: Reflects the number of items per page for this result, corresponding to the requested page size in the query. This helps in understanding the scope of the data returned.
      type: integer
      format: int32
      minimum: 0
      maximum: 2000
      default: 0
      example: 100
    QueryResultTotalCountProperty:
      description: Provides the total number of items available across all pages. This value is useful for understanding the entire dataset size and for calculating the total number of pages.
      type: integer
      format: int64
      minimum: 0
      default: 0
      example: 2000
    ListUserAssignmentsPagedHubQueryResult:
      description: Result of query for paged listing of user assignments.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubQueryResult'
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/QueryResultPageProperty'
        pageSize:
          $ref: '#/components/schemas/QueryResultPageSizeProperty'
        totalCount:
          $ref: '#/components/schemas/QueryResultTotalCountProperty'
        data:
          description: Contains the actual array of user assignments for the current page.
          type: array
          items:
            $ref: '#/components/schemas/HubUserAssignment'
    GetMetadataHubQueryResult:
      description: Result of query to get metadata from a Cozify Hub.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/HubQueryResult'
      additionalProperties: false
      properties:
        metadata:
          $ref: '#/components/schemas/HubMetadata'
    HubQueryResponse:
      description: |
        Deprecated. Use Graph QueryResponse with migrated hub queries.
      type: object
      deprecated: true
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/HubQueryResult'
      required:
        - result
    HubsQuery:
      description: Base type for all hubs queries.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hubs/GetDetailsHubsQuery: '#/components/schemas/GetDetailsHubsQuery'
          Cozify.Hubs/GetEntryHubsQuery: '#/components/schemas/GetEntryHubsQuery'
          Cozify.Hubs/ListHubsQuery: '#/components/schemas/ListHubsQuery'
          Cozify.Hubs/ListPagedHubsQuery: '#/components/schemas/ListPagedHubsQuery'
      required:
        - type
    GetDetailsHubsQuery:
      description: Query to get Hub details with given hub id.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQuery'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
      required:
        - hubId
    GetEntryHubsQuery:
      description: Query to get Hub entry with given hub id.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQuery'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
      required:
        - hubId
    ListHubsQueryFilter:
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hubs/ListHubsQuery/NameFilter: '#/components/schemas/ListHubsQueryNameFilter'
          Cozify.Hubs/ListHubsQuery/SerialNumberFilter: '#/components/schemas/ListHubsQuerySerialNumberFilter'
      required:
        - type
    HubNameProperty:
      description: The human readable name of the Hub.
      type: string
      maxLength: 50
      pattern: ^([a-zA-Z0-9_.\-\s\u0080-\uFFFF]+)$
      example: HUB-00001
      deprecated: true
    ListHubsQueryNameFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListHubsQueryFilter'
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/HubNameProperty'
      required:
        - name
    HubSerialNumberProperty:
      description: The serial number of the Hub.
      type: string
      maxLength: 64
      pattern: ^([a-zA-Z0-9-\s])+$
      example: 20240101-1-00000
      deprecated: true
    ListHubsQuerySerialNumberFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListHubsQueryFilter'
      additionalProperties: false
      properties:
        serialNumber:
          $ref: '#/components/schemas/HubSerialNumberProperty'
      required:
        - serialNumber
    ListHubsQuery:
      description: Query for listing of hubs.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQuery'
      additionalProperties: false
      properties:
        skip:
          $ref: '#/components/schemas/QuerySkip'
        limit:
          $ref: '#/components/schemas/QueryLimit'
        filters:
          description: Filters to apply to the query.
          type: array
          items:
            $ref: '#/components/schemas/ListHubsQueryFilter'
      required:
        - skip
        - limit
    ListPagedHubsQuery:
      description: Query for paged listing of hubs.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQuery'
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/QueryPageProperty'
        pageSize:
          $ref: '#/components/schemas/QueryPageSizeProperty'
        filters:
          description: Filters to apply to the query.
          type: array
          items:
            $ref: '#/components/schemas/ListHubsQueryFilter'
      required:
        - page
        - pageSize
    HubsQueryRequest:
      description: Request object for hubs queries.
      type: object
      additionalProperties: false
      properties:
        query:
          $ref: '#/components/schemas/HubsQuery'
      required:
        - query
    HubsQueryResult:
      description: Base type for all hubs query results.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          Cozify.Hubs/GetDetailsHubsQueryResult: '#/components/schemas/GetDetailsHubsQueryResult'
          Cozify.Hubs/GetEntryHubsQueryResult: '#/components/schemas/GetEntryHubsQueryResult'
          Cozify.Hubs/ListHubsQueryResult: '#/components/schemas/ListHubsQueryResult'
          Cozify.Hubs/ListPagedHubsQueryResult: '#/components/schemas/ListPagedHubsQueryResult'
      required:
        - type
    GetDetailsHubsQueryResult:
      description: Result of query to get Hub details with given hub id.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQueryResult'
      additionalProperties: false
      properties:
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
        name:
          $ref: '#/components/schemas/HubNameProperty'
        serialNumber:
          $ref: '#/components/schemas/HubSerialNumberProperty'
        deviceRegisterToken:
          description: The device register token if Hub is connected to any.
          type: string
    HubEntry:
      type: object
      additionalProperties: false
      properties:
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
        name:
          $ref: '#/components/schemas/HubNameProperty'
        serialNumber:
          $ref: '#/components/schemas/HubSerialNumberProperty'
        desiredVersion:
          description: The desired version of hub firmware.
          type: string
          maxLength: 16
          example: 1.1.1
        reportedVersion:
          description: The last reported version of hub firmware.
          type: string
          maxLength: 16
          example: 1.1.1
        model:
          description: The model of the hub.
          type: string
          maxLength: 64
      required:
        - createdAt
        - modifiedAt
        - hubId
        - name
        - serialNumber
        - desiredVersion
        - reportedVersion
        - model
    GetEntryHubsQueryResult:
      description: Result of query to get Hub entry with given hub id.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/HubEntry'
    ListHubsQueryResult:
      description: Result of query for listing of hubs.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQueryResult'
      additionalProperties: false
      properties:
        totalCount:
          $ref: '#/components/schemas/QueryResultTotalCountProperty'
        data:
          description: Contains the array of entries.
          type: array
          items:
            $ref: '#/components/schemas/HubEntry'
    ListPagedHubsQueryResult:
      description: Result of query for paged listing of hubs.
      type: object
      allOf:
        - $ref: '#/components/schemas/HubsQueryResult'
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/QueryResultPageProperty'
        pageSize:
          $ref: '#/components/schemas/QueryResultPageSizeProperty'
        totalCount:
          $ref: '#/components/schemas/QueryResultTotalCountProperty'
        data:
          description: Contains the actual array of device entries for the current page.
          type: array
          items:
            $ref: '#/components/schemas/HubEntry'
    HubsQueryResponse:
      description: |
        Response object for query result.
      type: object
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/HubsQueryResult'
      required:
        - result
    DeviceRegisterCommand:
      description: Base type for all device register commands.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/HubDeviceRegisterCommand: '#/components/schemas/HubDeviceRegisterCommand'
          Cozify.DeviceRegister/CreateEntryDeviceRegisterCommand: '#/components/schemas/CreateEntryDeviceRegisterCommand'
          Cozify.DeviceRegister/DeleteEntryDeviceRegisterCommand: '#/components/schemas/DeleteEntryDeviceRegisterCommand'
          Cozify.DeviceRegister/UpdateEntryDeviceRegisterCommand: '#/components/schemas/UpdateEntryDeviceRegisterCommand'
      required:
        - type
    DeviceIdProperty:
      description: The device identifier in device register provider.
      type: string
      minLength: 1
      maxLength: 256
      pattern: ^([a-z0-9\-_])+$
      example: 123e4567-e89b-12d3-a456-426655440000
    HubDeviceRegisterCommand:
      description: Deprecated. Use base Graph hub commands through /graph/command.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommand'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
        command:
          $ref: '#/components/schemas/HubCommand'
      required:
        - deviceId
        - command
    DeviceTypeProperty:
      description: The device type in device register provider.
      type: string
      minLength: 1
      maxLength: 50
      pattern: ^([A-Z0-9_])+$
      example: MY_CUSTOM_DEVICE
    DeviceNameProperty:
      description: The human readable name of the device.
      type: string
      maxLength: 50
      pattern: ^([a-zA-Z0-9_.\s\u0080-\uFFFF]+)$
      example: SuPa cool IoT gadget
    Capability:
      description: Defines the capability of the device.
      type: string
      pattern: ^([A-Z0-9_])+$
      example: SELF_MOTION
    DeviceManufacturerProperty:
      description: The manufacturer of the device.
      type: string
      maxLength: 50
      pattern: ^([a-zA-Z0-9_.\s\u0080-\uFFFF]+)$
      example: My Cömpany Ltd.
    DeviceModelProperty:
      description: The model of the device.
      type: string
      maxLength: 50
      pattern: ^([a-zA-Z0-9_.\s\u0080-\uFFFF]+)$
      example: Über IoT Device
    DeviceNativeIdProperty:
      description: The native identifier of the device.
      type: string
      maxLength: 50
      pattern: ^([a-zA-Z0-9_\-\s])+$
      example: 3RD_PARTY_1_6_DEVICE_ID
    DeviceSerialNumberProperty:
      description: The serial number of the device.
      type: string
      maxLength: 50
      pattern: ^([a-zA-Z0-9_\-\s])+$
      example: 4CE0460D0G
    RoutingEntry:
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/HubRoutingEntry: '#/components/schemas/HubRoutingEntry'
          Cozify.DeviceRegister/DeviceRoutingEntry: '#/components/schemas/DeviceRoutingEntry'
      required:
        - type
    HubRoutingEntry:
      type: object
      allOf:
        - $ref: '#/components/schemas/RoutingEntry'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
      required:
        - hubId
    DeviceRoutingEntry:
      type: object
      allOf:
        - $ref: '#/components/schemas/RoutingEntry'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
      required:
        - deviceId
    CreateEntryDeviceRegisterCommand:
      description: Command to create device entry at device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommand'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
        deviceType:
          $ref: '#/components/schemas/DeviceTypeProperty'
        name:
          $ref: '#/components/schemas/DeviceNameProperty'
        capabilities:
          description: The capabilities of the device.
          type: array
          items:
            $ref: '#/components/schemas/Capability'
        tags:
          $ref: '#/components/schemas/Tags'
        manufacturer:
          $ref: '#/components/schemas/DeviceManufacturerProperty'
        model:
          $ref: '#/components/schemas/DeviceModelProperty'
        nativeId:
          $ref: '#/components/schemas/DeviceNativeIdProperty'
        serialNumber:
          $ref: '#/components/schemas/DeviceSerialNumberProperty'
        routing:
          $ref: '#/components/schemas/RoutingEntry'
      required:
        - deviceId
        - deviceType
        - name
    DeleteEntryDeviceRegisterCommand:
      description: Command to delete device entry from device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommand'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
        recursive:
          type: boolean
          description: |
            If true, all child device entries will be also deleted. (default: is true)
          default: true
      required:
        - deviceId
    UpdateEntryDeviceRegisterCommand:
      description: Command to update device entry at device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommand'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
        name:
          $ref: '#/components/schemas/DeviceNameProperty'
        deviceType:
          $ref: '#/components/schemas/DeviceTypeProperty'
        capabilities:
          description: The capabilities of the device.
          type: array
          items:
            $ref: '#/components/schemas/Capability'
        tags:
          $ref: '#/components/schemas/Tags'
        manufacturer:
          $ref: '#/components/schemas/DeviceManufacturerProperty'
        model:
          $ref: '#/components/schemas/DeviceModelProperty'
        nativeId:
          $ref: '#/components/schemas/DeviceNativeIdProperty'
        serialNumber:
          $ref: '#/components/schemas/DeviceSerialNumberProperty'
        routing:
          $ref: '#/components/schemas/RoutingEntry'
      required:
        - deviceId
    DeviceRegisterCommandRequest:
      description: Request object for device register commands.
      type: object
      additionalProperties: false
      properties:
        command:
          $ref: '#/components/schemas/DeviceRegisterCommand'
      required:
        - command
    DeviceRegisterCommandResult:
      description: Base type for all device register command results.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/HubDeviceRegisterCommandResult: '#/components/schemas/HubDeviceRegisterCommandResult'
          Cozify.DeviceRegister/CreateEntryDeviceRegisterCommandResult: '#/components/schemas/CreateEntryDeviceRegisterCommandResult'
          Cozify.DeviceRegister/DeleteEntryDeviceRegisterCommandResult: '#/components/schemas/DeleteEntryDeviceRegisterCommandResult'
          Cozify.DeviceRegister/UpdateEntryDeviceRegisterCommandResult: '#/components/schemas/UpdateEntryDeviceRegisterCommandResult'
      required:
        - type
    HubDeviceRegisterCommandResult:
      description: Deprecated. Use base Graph command results for hub operations.
      type: object
      deprecated: true
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommandResult'
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/HubCommandResult'
    DeviceGatewayProperty:
      description: Defines if the device is a acting as an gateway device to other devices.
      type: boolean
      default: false
    DeviceState:
      type: object
      additionalProperties:
        type: string
    DeviceRegisterEntry:
      type: object
      additionalProperties: false
      properties:
        createdAt:
          $ref: '#/components/schemas/CreatedAt'
        modifiedAt:
          $ref: '#/components/schemas/ModifiedAt'
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
        deviceType:
          $ref: '#/components/schemas/DeviceTypeProperty'
        name:
          $ref: '#/components/schemas/DeviceNameProperty'
        capabilities:
          description: The capabilities of the device.
          type: array
          items:
            $ref: '#/components/schemas/Capability'
        tags:
          $ref: '#/components/schemas/Tags'
        gateway:
          $ref: '#/components/schemas/DeviceGatewayProperty'
        manufacturer:
          $ref: '#/components/schemas/DeviceManufacturerProperty'
        model:
          $ref: '#/components/schemas/DeviceModelProperty'
        nativeId:
          $ref: '#/components/schemas/DeviceNativeIdProperty'
        serialNumber:
          $ref: '#/components/schemas/DeviceSerialNumberProperty'
        routing:
          $ref: '#/components/schemas/RoutingEntry'
        state:
          $ref: '#/components/schemas/DeviceState'
      required:
        - deviceId
        - deviceType
        - name
        - capabilities
        - tags
        - gateway
        - state
    CreateEntryDeviceRegisterCommandResult:
      description: Result of command to create device entry at device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/DeviceRegisterEntry'
    DeleteEntryDeviceRegisterCommandResult:
      description: Result of command to delete device entry from device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommandResult'
      additionalProperties: false
      properties:
        entries:
          description: Contains the array of device entries deleted from registry.
          type: array
          items:
            $ref: '#/components/schemas/DeviceRegisterEntry'
    UpdateEntryDeviceRegisterCommandResult:
      description: Result of command to update device entry at device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterCommandResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/DeviceRegisterEntry'
    DeviceRegisterCommandResponse:
      description: |
        Response object for command result.
      type: object
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/DeviceRegisterCommandResult'
      required:
        - result
    DeviceRegisterQuery:
      description: Base type for all device register queries.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/GetEntryDeviceRegisterQuery: '#/components/schemas/GetEntryDeviceRegisterQuery'
          Cozify.DeviceRegister/ListEntriesPagedDeviceRegisterQuery: '#/components/schemas/ListEntriesPagedDeviceRegisterQuery'
          Cozify.DeviceRegister/HubDeviceRegisterQuery: '#/components/schemas/HubDeviceRegisterQuery'
          Cozify.DeviceRegister/GetListEntriesColumnParamsDeviceRegisterQuery: '#/components/schemas/GetListEntriesColumnParamsDeviceRegisterQuery'
      required:
        - type
    GetEntryDeviceRegisterQuery:
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQuery'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
      required:
        - deviceId
    ListEntriesDeviceRegisterQueryFilter:
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/KeywordFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryKeywordFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/NativeIdFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryNativeIdFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/SerialNumberFilter: '#/components/schemas/ListEntriesDeviceRegisterQuerySerialNumberFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/HubRoutingEntryFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryHubRoutingEntryFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/DeviceRoutingEntryFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryDeviceRoutingEntryFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/DeviceTypeFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryDeviceTypeFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/CapabilityFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryCapabilityFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/ManufacturerFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryManufacturerFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/ModelFilter: '#/components/schemas/ListEntriesDeviceRegisterQueryModelFilter'
          Cozify.DeviceRegister/ListEntriesDeviceRegisterQuery/SiteLinkFilter: '#/components/schemas/ListEntriesDeviceRegisterQuerySiteLinkFilter'
      required:
        - type
    ListEntriesDeviceRegisterQueryKeywordFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        keyword:
          description: The keyword to search for.
          type: string
          minLength: 2
      required:
        - keyword
    ListEntriesDeviceRegisterQueryNativeIdFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        nativeId:
          $ref: '#/components/schemas/DeviceNativeIdProperty'
      required:
        - nativeId
    ListEntriesDeviceRegisterQuerySerialNumberFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        serialNumber:
          $ref: '#/components/schemas/DeviceSerialNumberProperty'
      required:
        - serialNumber
    ListEntriesDeviceRegisterQueryHubRoutingEntryFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        hubId:
          $ref: '#/components/schemas/HubIdProperty'
      required:
        - hubId
    ListEntriesDeviceRegisterQueryDeviceRoutingEntryFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
      required:
        - deviceId
    ListEntriesDeviceRegisterQueryDeviceTypeFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        deviceType:
          $ref: '#/components/schemas/DeviceTypeProperty'
          example:
            - COZIFY_HUB
            - SIGNAL
            - MULTISENSOR
      required:
        - deviceType
    ListEntriesDeviceRegisterQueryCapabilityFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        capability:
          $ref: '#/components/schemas/Capability'
          example:
            - DEVICE
            - ON_OFF
            - TEMPERATURE
      required:
        - capability
    ListEntriesDeviceRegisterQueryManufacturerFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        manufacturer:
          $ref: '#/components/schemas/DeviceManufacturerProperty'
          example:
            - Cozify Oy
            - My Cömpany Ltd.
      required:
        - manufacturer
    ListEntriesDeviceRegisterQueryModelFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        model:
          $ref: '#/components/schemas/DeviceModelProperty'
          example:
            - ION
            - ZEN
            - DIN
            - Über IoT Device
      required:
        - model
    ListEntriesDeviceRegisterQuerySiteLinkFilter:
      type: object
      allOf:
        - $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      additionalProperties: false
      properties:
        siteId:
          description: |
            The identifier of the site to match.

            Use **NULL** to match entries without a site.
            Use '*' to match entries with any site.
          type: string
          minLength: 2
    ListEntriesPagedDeviceRegisterQuery:
      description: Query for paged listing of device register entries.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQuery'
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/QueryPageProperty'
        pageSize:
          $ref: '#/components/schemas/QueryPageSizeProperty'
        filters:
          description: Filters to apply to the query.
          type: array
          items:
            $ref: '#/components/schemas/ListEntriesDeviceRegisterQueryFilter'
      required:
        - page
        - pageSize
    HubDeviceRegisterQuery:
      description: Query to proxy HubQuery to Cozify Hub device at device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQuery'
      additionalProperties: false
      properties:
        deviceId:
          $ref: '#/components/schemas/DeviceIdProperty'
        query:
          $ref: '#/components/schemas/HubQuery'
      required:
        - deviceId
        - query
    GetListEntriesColumnParamsDeviceRegisterQuery:
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQuery'
      additionalProperties: false
      properties:
        deviceType:
          description: Include array of known device types in the result.
          type: boolean
          default: false
          example: false
        capabilities:
          description: Include array of known device capabilities in the result.
          type: boolean
          default: false
          example: false
        manufacturer:
          description: Include array of known device manufacturers in the result.
          type: boolean
          default: false
          example: false
        model:
          description: Include array of known device models in the result.
          type: boolean
          default: false
          example: false
    DeviceRegisterQueryRequest:
      description: Request object for device register queries.
      type: object
      additionalProperties: false
      properties:
        query:
          $ref: '#/components/schemas/DeviceRegisterQuery'
      required:
        - query
    DeviceRegisterQueryResult:
      description: Base type for all device register query results.
      type: object
      additionalProperties: false
      properties:
        type:
          description: A discriminator to identify the type.
          type: string
        error:
          $ref: '#/components/schemas/GraphError'
      discriminator:
        propertyName: type
        mapping:
          Cozify.DeviceRegister/GetEntryDeviceRegisterQueryResult: '#/components/schemas/GetEntryDeviceRegisterQueryResult'
          Cozify.DeviceRegister/ListEntriesPagedDeviceRegisterQueryResult: '#/components/schemas/ListEntriesPagedDeviceRegisterQueryResult'
          Cozify.DeviceRegister/HubDeviceRegisterQueryResult: '#/components/schemas/HubDeviceRegisterQueryResult'
          Cozify.DeviceRegister/GetListEntriesColumnParamsDeviceRegisterQueryResult: '#/components/schemas/GetListEntriesColumnParamsDeviceRegisterQueryResult'
      required:
        - type
    GetEntryDeviceRegisterQueryResult:
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQueryResult'
      additionalProperties: false
      properties:
        entry:
          $ref: '#/components/schemas/DeviceRegisterEntry'
    ListEntriesPagedDeviceRegisterQueryResult:
      description: Result of query for paged listing of device register entries.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQueryResult'
      additionalProperties: false
      properties:
        page:
          $ref: '#/components/schemas/QueryResultPageProperty'
        pageSize:
          $ref: '#/components/schemas/QueryResultPageSizeProperty'
        totalCount:
          $ref: '#/components/schemas/QueryResultTotalCountProperty'
        data:
          description: Contains the actual array of device entries for the current page.
          type: array
          items:
            $ref: '#/components/schemas/DeviceRegisterEntry'
    HubDeviceRegisterQueryResult:
      description: Result of query to proxy HubQuery to Cozify Hub device at device register.
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQueryResult'
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/HubQueryResult'
    GetListEntriesColumnParamsDeviceRegisterQueryResult:
      type: object
      allOf:
        - $ref: '#/components/schemas/DeviceRegisterQueryResult'
      additionalProperties: false
      properties:
        deviceType:
          description: Include array of known device types in the result.
          type: array
          items:
            $ref: '#/components/schemas/DeviceTypeProperty'
          example:
            - COZIFY_HUB
            - SIGNAL
            - MULTISENSOR
        capabilities:
          description: Include array of known device capabilities in the result.
          type: array
          items:
            $ref: '#/components/schemas/Capability'
          example:
            - DEVICE
            - ON_OFF
            - TEMPERATURE
        manufacturer:
          description: Include array of known device manufacturers in the result.
          type: array
          items:
            $ref: '#/components/schemas/DeviceManufacturerProperty'
          example:
            - Cozify Oy
            - My Cömpany Ltd.
        model:
          description: Include array of known device models in the result.
          type: array
          items:
            $ref: '#/components/schemas/DeviceModelProperty'
          example:
            - ION
            - ZEN
            - DIN
            - Über IoT Device
    DeviceRegisterQueryResponse:
      description: |
        Response object for query result.
      type: object
      additionalProperties: false
      properties:
        result:
          $ref: '#/components/schemas/DeviceRegisterQueryResult'
      required:
        - result
  responses:
    Problem:
      description: Problem
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem'
    Unauthorized:
      description: The request requires user authentication.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Problem'
    NotFound:
      description: The specified resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Problem'
  parameters:
    HubId:
      name: hubId
      in: path
      description: The identifier of the Cozify Hub.
      schema:
        $ref: '#/components/schemas/HubIdProperty'
      required: true
    DeviceRegisterId:
      name: deviceRegisterId
      in: path
      description: The identifier of the device register.
      schema:
        type: string
      required: true
