declare namespace Api {
  /** 系统管理类型 */
  namespace SystemManage {
    /** 用户状态 */
    type IdentityUserStatus = 1 | 2 | 3
    /** 批量用户操作类型 */
    type IdentityUserBatchOperation = 1 | 2 | 3 | 4 | 5
    /** 用户列表项 */
    interface UserListItem {
      userId: string
      tenantId: string
      account: string
      displayName: string
      avatar?: string
      phone?: string
      email?: string
      status: IdentityUserStatus
      isLocked: boolean
      isDeleted: boolean
      roles: string[]
      createdAt: string
      lastLoginAt?: string
    }
    /** 用户详情 */
    interface UserDetailDto {
      userId: string
      tenantId: string
      merchantId?: string
      account: string
      displayName: string
      phone?: string
      email?: string
      status: IdentityUserStatus
      isLocked: boolean
      roles: string[]
      roleIds: string[]
      permissions: string[]
      createdAt: string
      lastLoginAt?: string
      avatar?: string
      rowVersion: string
    }
    /** 用户列表响应 */
    type UserListResponse = Api.Common.PageResult<UserListItem>
    /** 用户搜索参数 */
    interface UserSearchParams extends Api.Common.PageParams {
      TenantId?: string
      Keyword?: string
      Status?: IdentityUserStatus
      RoleId?: string
      CreatedAtFrom?: string
      CreatedAtTo?: string
      LastLoginFrom?: string
      LastLoginTo?: string
      IncludeDeleted?: boolean
      SortBy?: string
      SortDescending?: boolean
    }
    /** 创建用户命令 */
    interface CreateIdentityUserCommand {
      tenantId?: string
      account: string
      displayName: string
      password: string
      phone?: string
      email?: string
      avatar?: string
      roleIds?: string[]
      status?: IdentityUserStatus
    }
    /** 更新用户命令 */
    interface UpdateIdentityUserCommand {
      userId?: string
      tenantId?: string
      displayName: string
      phone?: string
      email?: string
      avatar?: string
      roleIds?: string[]
      rowVersion: string
    }
    /** 更新用户状态命令 */
    interface ChangeIdentityUserStatusCommand {
      userId?: string
      tenantId?: string
      status: IdentityUserStatus
    }
    /** 重置密码结果 */
    interface ResetIdentityUserPasswordResult {
      token: string
      expiresAt: string
    }
    /** 批量操作失败项 */
    interface BatchIdentityUserFailureItem {
      userId: string
      reason: string
    }
    /** 批量用户操作命令 */
    interface BatchIdentityUserOperationCommand {
      tenantId?: string
      operation: IdentityUserBatchOperation
      userIds: string[]
    }
    /** 批量用户操作结果 */
    interface BatchIdentityUserOperationResult {
      successCount: number
      failureCount: number
      failures: BatchIdentityUserFailureItem[]
      exportItems: UserListItem[]
    }
  }
}
