openapi: 3.0.1
info:
  title: Tenant Cleanup Service
  description: The Tenant Cleanup Service provides an API for cleaning tenant data.
  version: '2.0'
tags:
  - name: TenantCleanupService
security:
  - Authorization: []
paths:
  /users/tenants/{tenantId}/cleanup:
    post:
      operationId: TenantCleanupService_CleanupTenantData
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/v2CleanupTenantDataResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/googleRpcStatus'
      parameters:
        - name: tenantId
          description: 'The tenant ID to cleanup data for. Required: true'
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenantCleanupServiceCleanupTenantDataBody'
        required: true
      tags:
        - TenantCleanupService
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:
    CleanupTenantDataResponseCleanupStatus:
      type: string
      enum:
        - SUCCESS
        - PARTIAL_SUCCESS
        - FAILED
      default: SUCCESS
    TenantCleanupServiceCleanupTenantDataBody:
      type: object
      properties:
        confirmCleanup:
          type: boolean
          title: Optional confirmation flag to ensure intentional cleanup
      title: Request message for cleaning up tenant data
    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'
    v2CleanupResults:
      type: object
      properties:
        permissionDeleted:
          type: string
          title: Permission deleted from MongoDB
        usersDeleted:
          type: string
          title: Users deleted from MongoDB
        rolesDeleted:
          type: string
          title: Roles deleted
        workspaceDeleted:
          type: string
          title: Workspace deleted
        userInviteDeleted:
          type: string
          title: User invite deleted
        userMappingDeleted:
          type: string
          title: User mapping deleted
        siteTemplatesDeleted:
          type: string
          title: Site templates deleted
        failures:
          type: array
          items:
            type: string
          title: List of any failures during cleanup
        hierarchyMetadataDeleted:
          type: string
          title: Hierarchy metadata deleted
      title: Detailed results of the cleanup operation
    v2CleanupTenantDataResponse:
      type: object
      properties:
        tenantId:
          type: string
          title: The tenant ID that was cleaned up
        status:
          $ref: '#/components/schemas/CleanupTenantDataResponseCleanupStatus'
        cleanupResults:
          $ref: '#/components/schemas/v2CleanupResults'
        errorMessage:
          type: string
          title: Any error messages if cleanup failed
        cleanupTimestamp:
          type: string
          format: int64
          title: Timestamp when cleanup was completed
      title: Response message for tenant data cleanup operation
    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
