Files
front-hokm/lib/feature/shop/domain/entities/shop_entities.dart
T
2026-07-05 16:03:15 +03:30

98 lines
2.3 KiB
Dart

/// موجودیت‌های کاتالوگ فروشگاه (مستقل از JSON).
class CoinPackage {
final String id;
final String title;
final int coins;
final int vipDays;
final int priceToman;
final int bonusPct;
final String sku; // شناسه‌ی محصول در پنلِ فروشگاه (برای پرداختِ native)
const CoinPackage({
required this.id,
required this.title,
required this.coins,
required this.vipDays,
required this.priceToman,
required this.bonusPct,
this.sku = '',
});
}
class TicketPackage {
final String id;
final String title;
final int tickets;
final int priceToman;
final String sku;
const TicketPackage({
required this.id,
required this.title,
required this.tickets,
required this.priceToman,
this.sku = '',
});
}
class CardSkin {
final String id;
final String title;
final int priceCoins;
const CardSkin(
{required this.id, required this.title, required this.priceCoins});
}
class Booster {
final String id;
final String title;
final int multiplier;
final int hours;
final int priceToman;
final String sku;
const Booster({
required this.id,
required this.title,
required this.multiplier,
required this.hours,
required this.priceToman,
this.sku = '',
});
}
class VipPackage {
final String id;
final String title;
final int months;
final int priceToman;
final String sku;
const VipPackage({
required this.id,
required this.title,
required this.months,
required this.priceToman,
this.sku = '',
});
}
/// کلِ داده‌ی فروشگاه: کاتالوگ + کارت‌های متعلق به کاربر + کارت انتخابی.
class ShopData {
final List<CoinPackage> coinPackages;
final List<TicketPackage> ticketPackages;
final List<CardSkin> cardSkins;
final List<Booster> boosters;
final List<VipPackage> vipPackages;
final List<String> ownedCards;
final String selectedCard;
const ShopData({
required this.coinPackages,
required this.ticketPackages,
required this.cardSkins,
required this.boosters,
required this.vipPackages,
required this.ownedCards,
required this.selectedCard,
});
bool owns(String cardId) => cardId == 'simple' || ownedCards.contains(cardId);
}