import 'package:equatable/equatable.dart';

/// وضعیت اقتصادی کاربر (پاسخ GET /api/wallet).
class Wallet extends Equatable {
  final int coins;
  final int tickets;
  final int xp;
  final int trophies;
  final int level;
  final int xpIntoLevel;
  final int xpForNext;
  final bool vip;
  final String selectedCard;

  const Wallet({
    required this.coins,
    required this.tickets,
    required this.xp,
    required this.trophies,
    required this.level,
    required this.xpIntoLevel,
    required this.xpForNext,
    required this.vip,
    required this.selectedCard,
  });

  factory Wallet.fromJson(Map<String, dynamic> j) => Wallet(
        coins: (j['coins'] ?? 0) as int,
        tickets: (j['tickets'] ?? 0) as int,
        xp: (j['xp'] ?? 0) as int,
        trophies: (j['trophies'] ?? 0) as int,
        level: (j['level'] ?? 1) as int,
        xpIntoLevel: (j['xp_into_level'] ?? 0) as int,
        xpForNext: (j['xp_for_next'] ?? 1) as int,
        vip: (j['vip'] ?? false) as bool,
        selectedCard: (j['selected_card'] ?? 'simple') as String,
      );

  @override
  List<Object?> get props =>
      [coins, tickets, xp, trophies, level, xpIntoLevel, xpForNext, vip, selectedCard];
}
