query UserApiKeys($userId: Uuid) {
  user(id: $userId) {
    userApiKeys {
      expiresAt
      id
      keyPreview
      name
      userId
    }
  }
}

query UserWorkspaces($userId: Uuid, $username: String) {
  user(id: $userId, username: $username) {
    workspaces {
      ...ReturnsWorkspace
      users(username: $username) {
        role
      }
    }
  }
}

query SearchUsers($username: String, $userId: Uuid) {
  user(username: $username, id: $userId) {
    ...ReturnsUser
  }
}

query WorkspaceUsers($workspaceId: Uuid, $workspaceName: String, $userId: Uuid, $username: String) {
  workspace(id: $workspaceId, name: $workspaceName) {
    users {
      role
      user(id: $userId, username: $username) {
        ...ReturnsUser
      }
    }
  }
}

query WorkspaceServiceApiKeys($workspaceId: Uuid) {
  workspace(id: $workspaceId) {
    serviceApiKeys {
      id
      expiresAt
      keyPreview
      name
      permissions
      workspaceId
    }
  }
}

query Me {
  me {
    ...ReturnsUser
  }
}

fragment ReturnsUser on User {
  displayName
  id
  isAdmin
  isSysadmin
  status
  username
}

fragment ReturnsWorkspace on Workspace {
  archived
  description
  id
  name
  createdAt
  updatedAt
}
