import 'package:byod/models/payment_list.dart';

import 'bill_detail.dart';

class Bill {
  String id;
  String totalSeluruhOrderan;
  String subTotalSeluruhOrderan;
  int totalPerCustomer;
  String customerName;
  int tableStatus;
  int orderStatus;
  int state;
  String outStandingPay;
  String outStandingIndividu;
  String dateOrder;
  List<BillDetail> billDetail;
  List<PaymentList> paymentList;
  String invoice;
  String totalService;
  String totalServiceTax;
  String discountTotal;
  String tableName;
  bool isFeedBack;
  String dokuMinPay;
  String packagingFee;
  String platformFee;
  // List<MemberInfo> memberInfo;

  Bill({
    required this.id,
    required this.totalSeluruhOrderan,
    required this.subTotalSeluruhOrderan,
    required this.totalPerCustomer,
    required this.customerName,
    required this.tableStatus,
    required this.orderStatus,
    required this.state,
    required this.outStandingPay,
    required this.outStandingIndividu,
    required this.dateOrder,
    this.billDetail = const [],
    this.paymentList = const [],
    required this.invoice,
    required this.totalService,
    required this.totalServiceTax,
    required this.discountTotal,
    required this.tableName,
    required this.isFeedBack,
    required this.dokuMinPay,
    this.packagingFee = "0.00",
    this.platformFee = "0.00",
    // this.memberInfo = const []
  });

  factory Bill.createBill(Map<String, dynamic> json) {
    return Bill(
      id: json['id'],
      totalSeluruhOrderan: json['total'],
      subTotalSeluruhOrderan: json['subtotal'],
      totalPerCustomer: json['total_per_customer'],
      customerName: json['customer_name'],
      tableStatus: json['table_status'],
      orderStatus: json['order_status'],
      state: json['order_state'],
      billDetail: json['order_detail'],
      paymentList: json['payment_list'],
      outStandingPay: json['outstanding'],
      invoice: json['invoice'],
      totalService: json['total_service'],
      totalServiceTax: json['total_service_tax'],
      outStandingIndividu: json['my_self_outstanding'],
      discountTotal: json['discount_total'],
      tableName: json['table_number'],
      isFeedBack: json['is_feedback'],
      dokuMinPay: json['doku_minimum_payment'],
      dateOrder: json['order_date'],
      packagingFee: json['packaging_fee'],
      platformFee: json['platform_fee'],
      // memberInfo: json['member_info']
    );
  }
}
