export interface User {
  id: number
  email: string
  username: string
  display_name: string | null
  avatar_url: string | null
  bio: string | null
  total_bets: number
  wins: number
  losses: number
  win_rate: number
  status: 'active' | 'suspended' | 'pending_verification'
  is_admin: boolean
  created_at: string
}

export interface UserSummary {
  id: number
  username: string
  display_name: string | null
  avatar_url: string | null
}

export interface Wallet {
  id: number
  user_id: number
  balance: string
  escrow: string
  blockchain_escrow: string
  currency: string
  created_at: string
  updated_at: string
}

export interface Transaction {
  id: number
  user_id: number
  type: 'deposit' | 'withdrawal' | 'bet_placed' | 'bet_won' | 'bet_lost' | 'bet_cancelled' | 'escrow_lock' | 'escrow_release'
  amount: string
  balance_after: string
  reference_id: number | null
  description: string
  status: 'pending' | 'completed' | 'failed'
  created_at: string
}

export type BetCategory = 'sports' | 'esports' | 'politics' | 'entertainment' | 'custom'
export type BetStatus = 'open' | 'matched' | 'in_progress' | 'pending_result' | 'completed' | 'cancelled' | 'disputed'
export type BetVisibility = 'public' | 'private' | 'friends_only'

export interface Bet {
  id: number
  title: string
  description: string
  category: BetCategory
  event_name: string
  event_date: string | null
  creator_position: string
  opponent_position: string
  creator_odds: number
  opponent_odds: number
  stake_amount: string
  currency: string
  status: BetStatus
  visibility: BetVisibility
  blockchain_bet_id: number | null
  blockchain_tx_hash: string | null
  blockchain_status: string | null
  creator: UserSummary
  opponent: UserSummary | null
  expires_at: string | null
  created_at: string
  updated_at: string
}

export interface BetDetail extends Bet {
  winner_id: number | null
  settled_at: string | null
  settled_by: string | null
}

export interface CreateBetData {
  title: string
  description: string
  category: BetCategory
  event_name: string
  event_date?: string
  creator_position: string
  opponent_position: string
  stake_amount: number
  creator_odds?: number
  opponent_odds?: number
  visibility?: BetVisibility
  expires_at?: string
}

export interface LoginData {
  email: string
  password: string
}

export interface RegisterData {
  email: string
  username: string
  password: string
  display_name?: string
}

export interface TokenResponse {
  access_token: string
  refresh_token: string
  token_type: string
}
