export type AuthRole = 'viewer' | 'member' | 'reviewer' | 'organization_team' | 'content_admin' | 'admin' | 'owner' | 'creator'

export interface AuthSession {
  sessionToken: string
  twitchUserId: string
  displayName: string
  role: AuthRole
  permissionKeys: string[]
  sessionIdleTimeoutHours: number
  mustChangePassword: boolean
  teamLogin: string | null
  boundTwitchUserId: string | null
  boundTwitchDisplayName: string | null
}

export interface LoginPayload {
  twitchUserId: string
  displayName: string
  role: AuthRole
}

export interface DemoLoginPayload {
  login: string
  password: string
}

export interface TeamLoginPayload {
  login: string
  password: string
}

export interface ChangePasswordPayload {
  currentPassword: string
  newPassword: string
}

export type TwitchAuthorizePurpose = 'team-login' | 'team-binding'

export interface TwitchAuthorizePayload {
  purpose: TwitchAuthorizePurpose
  returnUrl?: string
  frontendOrigin: string
}

export interface TwitchAuthorizeResponse {
  authorizationUrl: string
}

export interface TwitchBindingDisconnectResponse {
  disconnected: boolean
  loggedOut: boolean
  session: AuthSession | null
}
