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;
  num? mobile;
  String? contragent;
  final List<CheckItem>? items;
  CardData? cardData;
  CheckData({this.type, this.card, this.mobile, this.items, this.cardData, this.contragent});

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