part of '../wallet.dart'; /// Order milik customer di daftar riwayat (ยง4.5). @freezed abstract class CustomerOrder with _$CustomerOrder { const CustomerOrder._(); const factory CustomerOrder({ required String id, required String orderNumber, required String outletName, required String orderType, required String status, required String paymentStatus, required int totalAmount, required int itemCount, required bool isVoid, required bool isRefund, required int pointsEarned, required int coinsEarned, DateTime? createdAt, }) = _CustomerOrder; bool get isDineIn => orderType == 'dine_in'; } @freezed abstract class CustomerOrderPage with _$CustomerOrderPage { const factory CustomerOrderPage({ required List items, required int page, required int totalPages, }) = _CustomerOrderPage; } /// Detail order: field [order] ditambah rincian item dan pembayaran. @freezed abstract class CustomerOrderDetail with _$CustomerOrderDetail { const factory CustomerOrderDetail({ required CustomerOrder order, String? tableNumber, required int subtotal, required int discountAmount, required int taxAmount, required int refundAmount, required List items, required List payments, }) = _CustomerOrderDetail; } @freezed abstract class CustomerOrderItem with _$CustomerOrderItem { const CustomerOrderItem._(); const factory CustomerOrderItem({ required String id, required String productName, String? variantName, required int quantity, /// Hanya untuk item timbangan, mis. 4,2 [unitName]. double? weight, String? unitName, required int unitPrice, required int totalPrice, required int refundQuantity, }) = _CustomerOrderItem; bool get isWeighted => weight != null; } @freezed abstract class CustomerOrderPayment with _$CustomerOrderPayment { const CustomerOrderPayment._(); const factory CustomerOrderPayment({ required String id, required String methodName, required String methodType, required int amount, required int refundAmount, /// Hanya pada pembayaran EnakPoint. int? pointsUsed, }) = _CustomerOrderPayment; bool get isPoint => methodType == 'point'; }