import type {
  TencentBrowserActivityInfo,
  TencentBrowserReviewInfo,
  TencentBrowserSessionArtifacts,
} from './activity'
import type { TencentBrowserRedeemResult } from './redeem'

export type TencentLoginType = 'qq' | 'wx'

export type TencentBrowserSessionStatus =
  | 'waiting_scan'
  | 'scanned'
  | 'expired'
  | 'logged_in'
  | 'ready_to_redeem'
  | 'redeeming'
  | 'redeemed'
  | 'closed'
  | 'failed'
  | (string & {})

export interface TencentBrowserSessionData {
  sessionId: string
  loginType: TencentLoginType | string
  activityUrl: string
  status: TencentBrowserSessionStatus
  notice: string
  createdAt: string
  updatedAt: string
  expiresAt: string
  qrImageBase64: string
  qrUpdatedAt: string
  credentialReady: boolean
  activityInfo?: TencentBrowserActivityInfo | null
  review?: TencentBrowserReviewInfo | null
  redeem?: TencentBrowserRedeemResult | null
  artifacts: TencentBrowserSessionArtifacts
}

export interface TencentBrowserSessionSummaryData extends Omit<
  TencentBrowserSessionData,
  'qrImageBase64'
> {
  qrImageBase64?: string
}
