/**
 * Wallet transaction types
 */
export enum TransactionType {
  CREDIT = 'credit',
  DEBIT = 'debit'
}

/**
 * Transaction status
 */
export enum TransactionStatus {
  PENDING = 'pending',
  COMPLETED = 'completed',
  FAILED = 'failed',
  CANCELLED = 'cancelled'
}

/**
 * Transaction source
 */
export enum TransactionSource {
  REWARD_PAYMENT = 'reward_payment',
  MANUAL_ADJUSTMENT = 'manual_adjustment',
  SYSTEM_CORRECTION = 'system_correction'
}

/**
 * User wallet interface
 */
export interface UserWallet {
  id: string;
  userId: string;
  balance: number;
  currency: string;
  isActive: boolean;
  createdAt: Date;
  updatedAt: Date;
  lastTransactionAt?: Date;
}

/**
 * Wallet transaction interface
 */
export interface WalletTransaction {
  id: string;
  walletId: string;
  userId: string;
  type: TransactionType;
  amount: number;
  currency: string;
  status: TransactionStatus;
  source: TransactionSource;
  description: string;
  referenceId?: string; // Reference to reward, adjustment, etc.
  balanceBefore: number;
  balanceAfter: number;
  metadata?: Record<string, any>;
  createdAt: Date;
  updatedAt: Date;
  processedAt?: Date;
}

/**
 * Wallet balance summary
 */
export interface WalletBalanceSummary {
  totalBalance: number;
  pendingCredits: number;
  pendingDebits: number;
  availableBalance: number;
  currency: string;
  lastUpdated: Date;
}

/**
 * Transaction filter options
 */
export interface TransactionFilter {
  userId?: string;
  type?: TransactionType;
  status?: TransactionStatus;
  source?: TransactionSource;
  dateFrom?: Date;
  dateTo?: Date;
  amountMin?: number;
  amountMax?: number;
  limit?: number;
  offset?: number;
}

/**
 * Wallet statistics
 */
export interface WalletStatistics {
  totalEarned: number;
  totalSpent: number;
  transactionCount: number;
  averageTransaction: number;
  largestTransaction: number;
  monthlyEarnings: Array<{
    month: string;
    amount: number;
  }>;
  rewardBreakdown: Array<{
    type: string;
    amount: number;
    count: number;
  }>;
}

/**
 * Wallet creation input
 */
export interface CreateWalletInput {
  userId: string;
  currency?: string;
  initialBalance?: number;
}

/**
 * Transaction creation input
 */
export interface CreateTransactionInput {
  walletId: string;
  type: TransactionType;
  amount: number;
  source: TransactionSource;
  description: string;
  referenceId?: string;
  metadata?: Record<string, any>;
}