import 'package.dart';
import 'receipt.dart';

class Invoice {
  String invoiceNumber;
  DateTime invoiceDate;
  String customerName;
  String customerPhoneNumber;
  double amount;
  String discount;
  String status;
  String paymentAttachment;

  List<Package> packages;
  List<Receipt> receipts;
  List<String> receiptPhotos;

  Invoice(
      {this.invoiceNumber,
      this.invoiceDate,
      this.customerName,
      this.customerPhoneNumber,
      this.amount,
      this.discount,
      this.status,
      this.paymentAttachment,
      this.packages,
      this.receiptPhotos,
      this.receipts});

  double get getAmount => packages.fold(0, (p, e) => (e.rate * e.weight) + p);
}
