import type { SMS_SEND_EVENT_REGISTER } from '@/constants' export type AuthStatus = 'anonymous' | 'authenticated' | 'restoring' export type AuthSubmitContext = 'login' | 'register' export type AuthCoinAmount = number | string export interface AuthWithdrawAccount { receiveAccount?: string receiverEmail?: string receiverMobile?: string receiverName?: string } export interface AuthUser { createTime?: number channelId?: number coin?: AuthCoinAmount coinBalance?: number currentStreak?: number email?: string frozenBalance?: number headImage?: string id: string isJackpot?: boolean lastBetPeriodNo?: string name?: string oddsFactor?: number phone?: string registerInviteCode?: string riskFlags?: number roles?: string[] streakLevel?: number totalDepositCoin?: number totalWithdrawCoin?: number username?: string uuid?: string withdraw?: AuthWithdrawAccount } export interface AuthSessionInput { accessToken: string accessTokenExpiresAt?: number | null currentUser?: AuthUser | null refreshToken?: string | null } export interface AuthApiEnvelope { code: number data: T message?: string msg?: string } export interface AuthTokenDto { auth_token: string expires_in: number server_time: number } export interface AuthUserDto { channel_id: number coin: AuthCoinAmount phone?: string risk_flags: number username: string uuid: string } export interface AuthSessionDto { expires_in: number refresh_token?: string | null user: AuthUserDto 'user-token': string } export interface RefreshTokenDto { expires_in: number refresh_token?: string | null 'user-token': string } export interface AuthUserProfileDto { channel_id: number coin: number coin_balance: number create_time: number current_streak: number email: string frozen_balance: number head_image: string last_bet_period_no: string phone: string register_invite_code: string risk_flags: number total_deposit_coin: number total_withdraw_coin: number username: string uuid: string withdraw?: { receive_account: string receiver_email: string receiver_mobile: string receiver_name: string } | null } export interface LoginRequestDto { device_id?: string password: string username: string } export interface LogoutRequestDto { password: string username: string } export interface RegisterRequestDto { captcha: string device_id?: string invite_code: string password: string username: string } export interface SendSmsCodeRequestDto { event: typeof SMS_SEND_EVENT_REGISTER mobile: string } export interface SendSmsCodeDto { expires_in: number message_id: string } export interface RefreshTokenRequestDto { refresh_token: string } export interface LoginPayload { password: string username: string } export type LogoutPayload = LoginPayload export interface RegisterPayload { captcha: string inviteCode: string mobile: string password: string } export interface SendSmsCodePayload { mobile: string } export interface SendSmsCodeResult { expiresIn: number messageId: string } export type LoginFormValues = { password: string; username: string } export type RegisterFormValues = { captcha: string confirmPassword: string inviteCode: string mobile: string password: string } export interface UseLoginFormOptions { onSuccess?: () => void } export interface UseRegisterFormOptions { onSuccess?: () => void } export interface ClearAuthenticatedSessionOptions { clearBrowserStorage?: boolean clearQueryCache?: boolean } export interface UnauthorizedSessionOptions extends ClearAuthenticatedSessionOptions { openLoginModal?: boolean showLoginRequiredToast?: boolean } export type CurrentUserInitializer = () => Promise export type RefreshSessionHandler = ( refreshToken: string, ) => Promise