import 'package:aman_kassa_flutter/core/models/card_data.dart';
import 'package:aman_kassa_flutter/core/models/check_item.dart';

class CheckData {
  final String type;
  num card;
  final List<CheckItem> items;
  CardData cardData;
  CheckData({this.type, this.card, this.items, this.cardData});

  static CheckData fromJson(Map<String, dynamic> json) {
    return CheckData(
      type: json['type'],
      card: json['card'],
      items: (json['items'] as List).map((e) => CheckItem.fromJson(e)).toList(),
      cardData: CardData.fromJson(json['cardData'])
    );
  }
  Map<String, dynamic> toJson() =>
      {
        'type': type,
        'card': card,
        'items': items.map((e) => e.toJson()).toList(),
        'cardData': cardData!=null ? cardData.toJson() : null
      };
}