part of '../order.dart';

@freezed
class PaymentRequest with _$PaymentRequest {
  const factory PaymentRequest({
    required String orderId,
    required String paymentMethodId,
    required int amount,
    required String transactionId,
    required int splitNumber,
    required int splitTotal,
    required String splitDescription,
    required List<PaymentItemRequest> paymentOrderItems,
  }) = _PaymentRequest;

  factory PaymentRequest.empty() => const PaymentRequest(
    orderId: '',
    paymentMethodId: '',
    amount: 0,
    transactionId: '',
    splitNumber: 0,
    splitTotal: 0,
    splitDescription: '',
    paymentOrderItems: [],
  );
}

@freezed
class PaymentItemRequest with _$PaymentItemRequest {
  const factory PaymentItemRequest({
    required String orderItemId,
    required int amount,
  }) = _PaymentItemRequest;

  factory PaymentItemRequest.empty() =>
      const PaymentItemRequest(orderItemId: '', amount: 0);
}

@freezed
class PaymentSplitBillRequest with _$PaymentSplitBillRequest {
  const factory PaymentSplitBillRequest({
    required String orderId,
    required String paymentMethodId,
    required String customerId,
    required String customerName,
    required SplitType type, // e.g., "AMOUNT" or "ITEM"
    required int amount,
    required List<PaymentItemSplitBillRequest> items,
  }) = _PaymentSplitBillRequest;

  factory PaymentSplitBillRequest.empty() => const PaymentSplitBillRequest(
    orderId: '',
    paymentMethodId: '',
    customerId: '',
    type: SplitType.unknown,
    amount: 0,
    items: [],
    customerName: '',
  );
}

@freezed
class PaymentItemSplitBillRequest with _$PaymentItemSplitBillRequest {
  const factory PaymentItemSplitBillRequest({
    required String orderItemId,
    required int quantity,
  }) = _PaymentItemSplitBillRequest;

  factory PaymentItemSplitBillRequest.empty() =>
      const PaymentItemSplitBillRequest(orderItemId: '', quantity: 0);
}
