import 'package:flutter_test/flutter_test.dart';
import 'package:hakemsho/feature/wallet/data/model/wallet_model.dart';

void main() {
  test('WalletModel.fromJson parses wallet + user response', () {
    final w = WalletModel.fromJson(const {
      'coins': 4560,
      'tickets': 3,
      'xp': 325,
      'trophies': 12,
      'level': 8,
      'xp_into_level': 325,
      'xp_for_next': 400,
      'vip': true,
      'selected_card': 'swiss',
    }, const {
      'first_name': 'امیر',
      'avatar': 'hakem-3',
    });
    expect(w.coins, 4560);
    expect(w.tickets, 3);
    expect(w.level, 8);
    expect(w.vip, true);
    expect(w.selectedCard, 'swiss');
    expect(w.name, 'امیر');
    expect(w.avatar, 'hakem-3');
  });

  test('WalletModel.fromJson uses defaults for missing fields', () {
    final w = WalletModel.fromJson(const {}, const {});
    expect(w.coins, 0);
    expect(w.level, 1);
    expect(w.selectedCard, 'simple');
    expect(w.name, 'بازیکن');
    expect(w.avatar, 'hakem-1');
  });
}
