type SlackWorkspace {
  id: ID!
  tenantId: ID!
  slackTeamId: String!
  slackTeamName: String
  botUserId: String!
  appId: String!
  installedByUserId: ID
  status: String!
  installedAt: AWSDateTime!
  uninstalledAt: AWSDateTime
  createdAt: AWSDateTime!
  updatedAt: AWSDateTime!
}

type SlackWorkspaceInstallStart {
  authorizeUrl: AWSURL!
  state: String!
  expiresAt: AWSDateTime!
}

type SlackUserLink {
  id: ID!
  tenantId: ID!
  slackTeamId: String!
  slackTeamName: String
  slackUserId: String!
  slackUserName: String
  slackUserEmail: String
  userId: ID!
  status: String!
  linkedAt: AWSDateTime!
  unlinkedAt: AWSDateTime
  createdAt: AWSDateTime!
  updatedAt: AWSDateTime!
}

input StartSlackWorkspaceInstallInput {
  tenantId: ID!
  returnUrl: AWSURL
  redirectUri: AWSURL
}

extend type Query {
  slackWorkspaces(tenantId: ID!): [SlackWorkspace!]!
  mySlackLinks(tenantId: ID!): [SlackUserLink!]!
}

extend type Mutation {
  startSlackWorkspaceInstall(
    input: StartSlackWorkspaceInstallInput!
  ): SlackWorkspaceInstallStart!
  uninstallSlackWorkspace(id: ID!): SlackWorkspace!
  unlinkSlackIdentity(id: ID!): SlackUserLink!
}
