/// یک بسته‌ی پیام/شکلکِ چت (از backend). owned یعنی قابلِ استفاده است.
class ChatPack {
  final String id;
  final String title;
  final String kind; // text | emoji
  final int priceCoins;
  final bool vip; // برای VIP رایگان است
  final bool owned;
  final List<String> messages;

  const ChatPack({
    required this.id,
    required this.title,
    required this.kind,
    required this.priceCoins,
    required this.vip,
    required this.owned,
    required this.messages,
  });

  bool get isEmoji => kind == 'emoji';

  factory ChatPack.fromJson(Map<String, dynamic> j) => ChatPack(
        id: (j['id'] ?? '') as String,
        title: (j['title'] ?? '') as String,
        kind: (j['kind'] ?? 'text') as String,
        priceCoins: (j['price_coins'] ?? 0) as int,
        vip: (j['vip'] ?? false) as bool,
        owned: (j['owned'] ?? false) as bool,
        messages: ((j['messages'] as List?) ?? const [])
            .map((e) => e as String)
            .toList(),
      );
}
