openapi: 3.0.1
info:
  title: Department Service
  description: The Department Service is a utility API ontop of workspaces to facilitate Department hierarchies.
  version: '2.0'
tags:
  - name: DepartmentService
security:
  - Authorization: []
paths:
  /users/department:
    get:
      summary: |-
        List all departments.
         Permission Level: Read
      operationId: DepartmentService_ListDepartments
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2ListDepartmentsResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: genericFilter
          description: |-
            Generic filter for department fields (name, parent, displayName)
            If it contains a whitespace, it splits the text and filter by both words. Required: false
          in: query
          required: false
          schema:
            type: string
        - name: tenantId
          description: 'TenantId of the Department. Required: false (False as this can be inferred from the token)'
          in: query
          required: false
          schema:
            type: string
        - name: pageSize
          description: 'Items per page. Required: false'
          in: query
          required: false
          schema:
            type: integer
            format: int32
        - name: pageToken
          description: 'Mongo DB Field, describes the encoded page token for page traversal. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: sortField
          description: 'Sort field valid values: name, parent, displayName, lastUpdated. Default: name. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: sortType
          description: 'Sort Type for the results. Default: ASC, Required: false'
          in: query
          required: false
          schema:
            type: string
            enum:
              - NONE
              - ASC
              - DESC
            default: NONE
        - name: domain
          description: 'Domain of the department (example: zpa, reflexis, wfc, etc). Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: scope
          description: 'Scope of the department. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: specificFilter.displayName
          description: Only non blank
          in: query
          required: false
          schema:
            type: string
        - name: specificFilter.parentSpecificFilter.parent
          in: query
          required: false
          schema:
            type: string
        - name: specificFilter.hierarchyNodeSpecificFilter.isHierarchyNode
          in: query
          required: false
          schema:
            type: boolean
        - name: startsWithSingleCharacter
          description: 'Ability to search for a single starts with character, only applicable to specific_filter: display_name.  Default: false, Required: false'
          in: query
          required: false
          schema:
            type: boolean
        - name: includeUsers
          description: 'Whether to include list of users who belong to the department. Required : false'
          in: query
          required: false
          schema:
            type: boolean
        - name: excludeTenantIds
          description: 'List of tenant IDs to exclude. Required: false'
          in: query
          required: false
          explode: true
          schema:
            type: array
            items:
              type: string
        - name: statusInScope
          description: |-
            The enabled status of the department's scope in this request to search on, Default: enabled, Required: false

             - ENTITY_ENABLED: Entity is enabled
             - ENTITY_DISABLED: Entity is disabled
             - ENTITY_BOTH_ENABLED_DISABLED: Entity either enabled or disabled
          in: query
          required: false
          schema:
            type: string
            enum:
              - ENTITY_ENABLED
              - ENTITY_DISABLED
              - ENTITY_BOTH_ENABLED_DISABLED
            default: ENTITY_ENABLED
      tags:
        - DepartmentService
    post:
      summary: Create a new Department. (Which is represented with the low level data structure workspace)
      description: |-
        This is a convenience level above CreateWorkspace.

        Permission Level: Read-Write
      operationId: DepartmentService_CreateDepartment
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2CreateDepartmentResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2CreateDepartmentRequest'
        description: Mimics CreateWorkspaceRequest, but removes the fields `workspace_type` as that field can be populated through keywords/business logic.
        required: true
      tags:
        - DepartmentService
    put:
      summary: Update a department.
      description: 'Permission Level: Read-Write'
      operationId: DepartmentService_UpdateDepartment
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2UpdateDepartmentResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/v2UpdateDepartmentRequest'
        required: true
      tags:
        - DepartmentService
  /users/department/basicdepartments:
    get:
      summary: |-
        Return a list of limited departments.
        "Return at most 500 departments" and "If over 500 the truncated flag indicates there is more data that is not returned".
         Permission Level: Read
      operationId: DepartmentService_ListBasicDepartments
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2ListBasicDepartmentsResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: tenantId
          description: 'TenantId of the Department. Required: false (False as this can be inferred from the token)'
          in: query
          required: false
          schema:
            type: string
      tags:
        - DepartmentService
  /users/department/name/{name}:
    get:
      summary: Get a Department by name.
      description: |-
        This is a convenience level above GetWorkspace.

        Permission Level: Read
      operationId: DepartmentService_GetDepartment
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2GetDepartmentResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: name
          description: Name of the Department, Required = true
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: 'TenantId of the Department. Required: false (False as this can be inferred from the token)'
          in: query
          required: false
          schema:
            type: string
        - name: includeUsers
          description: 'Whether to include list of users who belong to the department. Required : false'
          in: query
          required: false
          schema:
            type: boolean
      tags:
        - DepartmentService
    delete:
      summary: Delete one Department by name.
      description: |-
        This is an extension of DeleteWorkspace and DeleteThings.

        Permission Level: Read-Write
      operationId: DepartmentService_DeleteDepartment
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                type: object
                properties: {}
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: name
          description: Name of the Department, Required = true
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: 'TenantId of the Department. Required: false (False as this can be inferred from the token)'
          in: query
          required: false
          schema:
            type: string
      tags:
        - DepartmentService
  /users/department/roles:
    get:
      summary: |-
        List roles for the given department
        Permission Level: Read
      operationId: DepartmentService_ListDepartmentRoles
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2ListDepartmentRolesResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: departmentName
          description: 'Name of the department. Required: true'
          in: query
          required: false
          schema:
            type: string
        - name: tenantId
          description: 'Tenant of the department. Required: false'
          in: query
          required: false
          schema:
            type: string
      tags:
        - DepartmentService
  /users/department/{departmentName}/roles:
    delete:
      summary: |-
        Remove roles from a department.
        It is required a department and list of roles to be removed.
        Permission Level: Read-Write
      operationId: DepartmentService_DeleteDepartmentRoles
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2DepartmentRoleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: departmentName
          description: 'Name of the department. Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentServiceDeleteDepartmentRolesBody'
        required: true
      tags:
        - DepartmentService
    post:
      summary: |-
        Add roles to a department.
        It is required a department and list of roles to be added.
        Permission Level: Read-Write
      operationId: DepartmentService_AddDepartmentRoles
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2DepartmentRoleResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: departmentName
          description: 'Name of the department. Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentServiceAddDepartmentRolesBody'
        required: true
      tags:
        - DepartmentService
  /users/department/{departmentName}/sites:
    get:
      summary: |-
        List valid sites for a given department
        Permission Level: Read
      operationId: DepartmentService_ListValidSites
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2ListSitesResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: departmentName
          description: 'Name of the department. Required: true'
          in: path
          required: true
          schema:
            type: string
        - name: tenantId
          description: 'Tenant of the department. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: nextPageToken
          description: 'Next page token. Required: false'
          in: query
          required: false
          schema:
            type: string
        - name: pageSize
          description: 'Number of sites returned per page. Required: false, Default: 10'
          in: query
          required: false
          schema:
            type: integer
            format: int32
      tags:
        - DepartmentService
  /users/department/{departmentName}/users:
    delete:
      summary: |-
        Remove users from a department.
         It is required a department and a list of users to remove.
         Permission Level: Read-Write
      operationId: DepartmentService_DeleteDepartmentUsers
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2DepartmentProto'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: departmentName
          description: 'Name of the department. Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentServiceDeleteDepartmentUsersBody'
        required: true
      tags:
        - DepartmentService
    post:
      summary: |-
        Add users to a department.
         Permission Level: Read-Write
      operationId: DepartmentService_AddDepartmentUsers
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2DepartmentProto'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: departmentName
          description: 'Name of the department. Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentServiceAddDepartmentUsersBody'
        required: true
      tags:
        - DepartmentService
  /users/department/{relationName}/{relationType}/departments:
    post:
      summary: |-
        Add departments to a site department relation.
        It is required for the relation to exist.
        Permission Level: Read-Write
      operationId: DepartmentService_AddDepartmentsSiteDepartmentRelation
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2AddDepartmentsSiteDepartmentRelationResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: relationName
          description: 'The name of the relation that you want to add the departments to. Required: true'
          in: path
          required: true
          schema:
            type: string
        - name: relationType
          description: 'The type of the relation that you want to add the departments to. Required: true'
          in: path
          required: true
          schema:
            type: string
            enum:
              - SITE_TYPE
              - SITE_TIER
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DepartmentServiceAddDepartmentsSiteDepartmentRelationBody'
        required: true
      tags:
        - DepartmentService
servers:
  - url: https://prod-ui-zwseuprod01p.pp.zebra.com/api
    description: EU Server
  - url: https://prod-ui-zwsusprod01p.pp.zebra.com/api
    description: NA Server
components:
  schemas:
    DepartmentServiceAddDepartmentRolesBody:
      type: object
      properties:
        tenantId:
          type: string
          title: 'Tenant of the department. Required: false'
        roles:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueRoleProto'
          title: 'List of roles to be added/removed from the department. Required: true'
    DepartmentServiceAddDepartmentUsersBody:
      type: object
      properties:
        tenantId:
          type: string
          title: 'Tenant of the department. Required: false'
        users:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueUserProto'
          title: 'list of users (user_ids) to add to the department. Required: true'
    DepartmentServiceAddDepartmentsSiteDepartmentRelationBody:
      type: object
      properties:
        tenantId:
          type: string
          title: 'The tenant of the relation. Required: false'
        departments:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueDepartmentProto'
          title: 'The departments you want to add the relation to. Required: true'
    DepartmentServiceDeleteDepartmentRolesBody:
      type: object
      properties:
        tenantId:
          type: string
          title: 'Tenant of the department. Required: false'
        roles:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueRoleProto'
          title: 'List of roles to be added/removed from the department. Required: true'
    DepartmentServiceDeleteDepartmentUsersBody:
      type: object
      properties:
        tenantId:
          type: string
          title: 'Tenant of the department. Required: false'
        users:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueUserProto'
          title: 'list of users (user_ids) to add to the department. Required: true'
    commonsSortType:
      type: string
      enum:
        - NONE
        - ASC
        - DESC
      default: NONE
    protobufAny:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    rpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
    typeDate:
      type: object
      properties:
        year:
          type: integer
          format: int32
          description: |-
            Year of the date. Must be from 1 to 9999, or 0 to specify a date without
            a year.
        month:
          type: integer
          format: int32
          description: |-
            Month of a year. Must be from 1 to 12, or 0 to specify a year without a
            month and day.
        day:
          type: integer
          format: int32
          description: |-
            Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
            to specify a year by itself or a year and month where the day isn't
            significant.
      description: |-
        * A full date, with non-zero year, month, and day values
        * A month and day value, with a zero year, such as an anniversary
        * A year on its own, with zero month and day values
        * A year and month value, with a zero day, such as a credit card expiration
        date

        Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
        `google.protobuf.Timestamp`.
      title: |-
        Represents a whole or partial calendar date, such as a birthday. The time of
        day and time zone are either specified elsewhere or are insignificant. The
        date is relative to the Gregorian Calendar. This can represent one of the
        following:
    v2AddDepartmentsSiteDepartmentRelationResponse:
      type: object
      properties:
        relationName:
          type: string
          title: 'The name of the relation that you want to add the departments to. Required: true'
        relationType:
          $ref: '#/components/schemas/v2SiteDepartmentRelationType'
        tenantId:
          type: string
          title: 'The tenant of the relation. Required: false'
        departments:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueDepartmentProto'
          title: 'The departments you want to add the relation to. Required: true'
    v2BasicDepartmentResponse:
      type: object
      properties:
        name:
          type: string
          title: Name of the department (Mapped from workspace)
        displayName:
          type: string
          title: Friendly display name of the department (Mapped from workspace)
    v2CreateDepartmentRequest:
      type: object
      properties:
        name:
          type: string
          title: Name of the Department, Required = true
        tenantId:
          type: string
          title: 'TenantId of the Department. Required: false (False as this can be inferred from the token)'
        parent:
          type: string
          title: Name of the parent of the Department, Required = false
        displayName:
          type: string
          title: Friendly display name, Required = false
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Department specific attributes, Required = false
        domain:
          type: string
          title: 'Domain of the department (example: zpa, reflexis, wfc, etc), Required: false'
        scope:
          type: string
          title: 'Scope of the department , Required: false'
        description:
          type: string
          title: 'department free form description, Required: false'
        expiration:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/typeDate'
          title: 'Scopes and expiration dates, Required: false'
      description: Mimics CreateWorkspaceRequest, but removes the fields `workspace_type` as that field can be populated through keywords/business logic.
    v2CreateDepartmentResponse:
      type: object
      properties:
        name:
          type: string
          title: Name of the Department
        tenantId:
          type: string
          title: TenantId of the Department
        parent:
          type: string
          title: Name of the parent of the Department
        displayName:
          type: string
          title: Friendly display name
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Department specific attributes, Required = false
        domain:
          type: string
          title: 'Domain of the department (example: zpa, reflexis, wfc, etc), Required: false'
        enabledScopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scopes and status (enable, disable) for a department. Scope is optional. Typically applications will always pass their scope, but it is optional for admin purposes, Default: empty'
        description:
          type: string
          title: 'department free form description, Required: false'
        expiration:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/typeDate'
          title: 'Scopes and expiration dates, Required: false'
    v2DepartmentAttributeProto:
      type: object
      properties:
        scope:
          type: string
          title: 'General scoping for department attribute. Required: false'
        fieldName:
          type: string
          title: 'Name of the attribute. Required: true'
        value:
          type: string
          title: 'Value of the attribute. Required: false'
        domain:
          type: string
          title: 'Domain of the attribute. Required : false'
      title: Mimics the attributes that are contained within Workspaces
    v2DepartmentProto:
      type: object
      properties:
        name:
          type: string
          title: Name of the department (Mapped from workspace)
        parent:
          type: string
          title: Name of the parent of the department (Mapped from workspace)
        tenantId:
          type: string
          title: Tenant of the department
        ancestors:
          type: array
          items:
            type: string
          title: Ancestor list of the department (Mapped from workspace)
        descendants:
          type: array
          items:
            type: string
          title: Flattened list of descendants of the department (Mapped from workspace)
        displayName:
          type: string
          title: Friendly display name of the department (Mapped from workspace)
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Attributes of the department
        enabledScopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scopes and status (enable, disable) for a department. Scope is optional. Typically applications will always pass their scope, but it is optional for admin purposes, Default: empty'
        creationTime:
          type: string
          format: date-time
          title: Time of creation of department entity
        domain:
          type: string
          title: Department domain
        lastUpdated:
          type: string
          format: date-time
          title: Time of most recent update to the department entity
        description:
          type: string
          title: Department free form description
        expiration:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/typeDate'
          title: Scopes and expiration dates
        users:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueUserProto'
          title: List of users who belong to the department
    v2DepartmentRoleProto:
      type: object
      properties:
        name:
          type: string
          title: Name of the department (Mapped from workspace)
        parent:
          type: string
          title: Name of the parent of the department (Mapped from workspace)
        tenantId:
          type: string
          title: Tenant of the department
        ancestors:
          type: array
          items:
            type: string
          title: Ancestor list of the department (Mapped from workspace)
        descendants:
          type: array
          items:
            type: string
          title: Flattened list of descendants of the department (Mapped from workspace)
        displayName:
          type: string
          title: Friendly display name of the department (Mapped from workspace)
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Attributes of the department
        roles:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueRoleProto'
          title: List of roles which belong to the department
        enabledScopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scopes and status (enable, disable) for a site Scope is optional. Typically applications will always pass their scope, but it is optional for admin purposes, Default: empty'
        creationTime:
          type: string
          format: date-time
          title: Time of creation of department entity
        domain:
          type: string
          title: Department domain
        lastUpdated:
          type: string
          format: date-time
          title: Time of most recent update to the department entity
        description:
          type: string
          title: Department free form description
    v2DepartmentRoleResponse:
      type: object
      properties:
        department:
          $ref: '#/components/schemas/v2DepartmentRoleProto'
    v2EnabledStatusInScope:
      type: string
      enum:
        - ENTITY_ENABLED
        - ENTITY_DISABLED
        - ENTITY_BOTH_ENABLED_DISABLED
      default: ENTITY_ENABLED
      description: |-
        - ENTITY_ENABLED: Entity is enabled
         - ENTITY_DISABLED: Entity is disabled
         - ENTITY_BOTH_ENABLED_DISABLED: Entity either enabled or disabled
      title: This enum represents the search of Enabled/Disabled/Both for a entity's scope
    v2GetDepartmentResponse:
      type: object
      properties:
        name:
          type: string
          title: Name of the Department (Mapped from workspace)
        parent:
          type: string
          title: Name of the parent of the Department (Mapped from workspace)
        ancestors:
          type: array
          items:
            type: string
          title: Ancestor list of the Department (Mapped from workspace)
        descendants:
          type: array
          items:
            type: string
          title: Flattened list of descendants of the Department (Mapped from workspace)
        displayName:
          type: string
          title: Friendly display name of the Department (Mapped from workspace)
        creationTime:
          type: string
          format: date-time
          title: Department creation time
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Attributes of the department
        domain:
          type: string
          title: 'Domain of the department (example: zpa, reflexis, wfc, etc), Required: false'
        enabledScopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scopes and status (enable, disable) for a department. Scope is optional. Typically applications will always pass their scope, but it is optional for admin purposes, Default: empty'
        users:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueUserProto'
          title: List of users who belong to the department
        description:
          type: string
          title: Department free form description
      title: This encapsulates a workspace
    v2HierarchyNodeSpecificFilter:
      type: object
      properties:
        isHierarchyNode:
          type: boolean
      title: Controls Retail Operating Model "Hierarchy Node" specific filter null or empty or value
    v2ListBasicDepartmentsResponse:
      type: object
      properties:
        departments:
          type: array
          items:
            $ref: '#/components/schemas/v2BasicDepartmentResponse'
        resultsTruncated:
          type: boolean
    v2ListDepartmentRolesResponse:
      type: object
      properties:
        roles:
          type: array
          items:
            $ref: '#/components/schemas/v2MinimalRoleResponse'
        inheritedRoles:
          type: array
          items:
            $ref: '#/components/schemas/v2MinimalRoleResponse'
    v2ListDepartmentsResponse:
      type: object
      properties:
        departments:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentProto'
          title: List of departments found
        nextPageToken:
          type: string
          title: Next page token
    v2ListSitesResponse:
      type: object
      properties:
        sites:
          type: array
          items:
            $ref: '#/components/schemas/v2SiteProto'
          title: List of sites found
        nextPageToken:
          type: string
          title: Next page token
    v2MinimalRoleResponse:
      type: object
      properties:
        tenantId:
          type: string
          title: The id of the tenant
        domain:
          type: string
          title: 'The platform domain (example: zpa, reflexis, wfc)'
        scope:
          type: string
          description: Some more general scoping for the data (like a particular app in the domain).
        roleId:
          type: string
          title: Role id
        description:
          type: string
          description: Role description.
      title: The role data model, fewer fields
    v2ParentSpecificFilter:
      type: object
      properties:
        parent:
          type: string
      title: Controls parent specific filter null or empty or value
    v2SiteAttributeProto:
      type: object
      properties:
        scope:
          type: string
          title: 'General scoping for site attribute. Required: false'
        fieldName:
          type: string
          title: 'Name of the attribute. Required: true'
        value:
          type: string
          title: 'Value of the attribute. Required: false'
        domain:
          type: string
          title: 'Domain of the attribute. Required : false'
      title: Mimics the attributes that are contained within Workspaces
    v2SiteDepartmentRelationType:
      type: string
      enum:
        - SITE_TYPE
        - SITE_TIER
      default: SITE_TYPE
      description: Enum with all possible values for the Site-Department relation type.
    v2SiteProto:
      type: object
      properties:
        name:
          type: string
          title: Name of the site (Mapped from workspace)
        parent:
          type: string
          title: Name of the parent of the site (Mapped from workspace)
        tenantId:
          type: string
          title: Tenant of the site
        ancestors:
          type: array
          items:
            type: string
          title: Ancestor list of the site (Mapped from workspace)
        descendants:
          type: array
          items:
            type: string
          title: Flattened list of descendants of the site (Mapped from workspace)
        displayName:
          type: string
          title: Friendly display name of the site (Mapped from workspace)
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2SiteAttributeProto'
          title: Attributes of the site
        users:
          type: array
          items:
            $ref: '#/components/schemas/v2UniqueUserProto'
          title: List of users who belong to the site
        enabledScopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scopes and status (enable, disable) for a site Scope is optional. Typically applications will always pass their scope, but it is optional for admin purposes, Default: empty'
        creationTime:
          type: string
          format: date-time
          title: Time of creation of site entity
        domain:
          type: string
          title: Site domain
        lastUpdated:
          type: string
          format: date-time
          title: Time of most recent update to the site entity
        description:
          type: string
          title: Site free form description
        expiration:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/typeDate'
          title: Scopes and expiration dates
        siteType:
          type: string
          title: The site_type that the site possesses
        siteTier:
          type: string
          title: The site_tier that the site possesses
        isHierarchyNode:
          type: boolean
          description: |-
            True if is a Retail Operating Model "Hierarchy Node", false if it is a Retail Operating Model "Site".
            Defaults to a Retail Operating Model "Site" if not included.
    v2UniqueDepartmentProto:
      type: object
      properties:
        tenantId:
          type: string
          description: Used to lookup the department for validation
          title: 'TenantId of the Department. Required: false'
        departmentName:
          type: string
          description: Populates propertyNameStatusValues.propertyNameStatusValues.name
          title: 'Name of the Department. Required: true'
        departmentFriendlyName:
          type: string
          description: Populates propertyNameStatusValues.propertyNameStatusValues.friendlyName
          title: 'Friendly name of the Department. Required: true'
    v2UniqueRoleProto:
      type: object
      properties:
        tenantId:
          type: string
          description: 'The ID of the tenant. Required: false. Defaults to the tenant of the user making the call.'
        domain:
          type: string
          description: |-
            The platform domain. Required: true. (e.g. ZPA, Reflexis, WFC)
            Defaults to the domain in the request.
        scope:
          type: string
          description: 'Some more general scoping for the data (like a particular app in the domain). Required: false.'
        roleId:
          type: string
          description: 'The role ID. Required: true.'
        userIds:
          type: array
          items:
            type: string
          title: 'The User Ids for the Unique Role Proto, Required: false'
    v2UniqueUserProto:
      type: object
      properties:
        tenantId:
          type: string
          description: 'The ID of the tenant. Required: false. Defaults to the tenant of the user making the call.'
        userId:
          type: string
          description: 'The user ID. Required: true.'
        firstName:
          type: string
          description: 'The first name. Required: false.'
        lastName:
          type: string
          description: 'The last name. Required: false.'
    v2UpdateDepartmentRequest:
      type: object
      properties:
        name:
          type: string
          title: Name of the Department, Required = true
        tenantId:
          type: string
          title: 'TenantId of the Department. Required: false (False as this can be inferred from the token)'
        parent:
          type: string
          title: Name of the parent of the Department, Required = false
        displayName:
          type: string
          title: Friendly display name, Required = false
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Department specific attributes, Required = false
        domain:
          type: string
          title: 'Domain of the department (example: zpa, reflexis, wfc, etc), Required: false'
        updateFieldMask:
          type: string
          title: |-
            FieldMask to control what fields are to be updated, Required: false
            Valid path names (display_name, parent, attributes, scopes, description) as related to WorkspaceProto
        updateScopeOption:
          $ref: '#/components/schemas/v2UpdateWorkspaceScope'
        description:
          type: string
          title: 'Updated department description, Required: false'
        expiration:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/typeDate'
          title: 'Scopes and expiration dates, Required: false'
    v2UpdateDepartmentResponse:
      type: object
      properties:
        name:
          type: string
          title: Name of the Department
        tenantId:
          type: string
          title: TenantId of the Department
        parent:
          type: string
          title: Name of the parent of the Department
        displayName:
          type: string
          title: Friendly display name
        attributes:
          type: array
          items:
            $ref: '#/components/schemas/v2DepartmentAttributeProto'
          title: Department specific attributes, Required = false
        domain:
          type: string
          title: 'Domain of the department (example: zpa, reflexis, wfc, etc), Required: false'
        enabledScopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scopes and status (enable, disable) for a department. Scope is optional. Typically applications will always pass their scope, but it is optional for admin purposes, Default: empty'
        description:
          type: string
          title: 'department free form description, Required: false'
        expiration:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/typeDate'
          title: 'Scopes and expiration dates, Required: false'
    v2UpdateWorkspaceScope:
      type: object
      properties:
        scopes:
          type: object
          additionalProperties:
            type: boolean
          title: 'Scope names and enabled status, Required: false'
        autoRemoveUsers:
          type: boolean
          title: 'Option to remove the workspace from related users upon disabling, Required: false, Default: false'
    v2WorkspaceSpecificFilter:
      type: object
      properties:
        displayName:
          type: string
          title: Only non blank
        parentSpecificFilter:
          $ref: '#/components/schemas/v2ParentSpecificFilter'
        hierarchyNodeSpecificFilter:
          $ref: '#/components/schemas/v2HierarchyNodeSpecificFilter'
      title: 'This will create and AND criteria on the specific fields for any of the values. Required: false'
    googleRpcStatus:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/protobufAny'
  securitySchemes:
    Authorization:
      type: apiKey
      description: Bearer token
      name: Authorization
      in: header
