import 'package:pshared/data/dto/payment/payment_quote.dart';
import 'package:pshared/data/mapper/payment/fee_line.dart';
import 'package:pshared/data/mapper/payment/fx_quote.dart';
import 'package:pshared/data/mapper/payment/money.dart';
import 'package:pshared/data/mapper/payment/network_fee.dart';
import 'package:pshared/models/payment/quote/quote.dart';


extension PaymentQuoteDTOMapper on PaymentQuoteDTO {
  PaymentQuote toDomain({String? idempotencyKey}) => PaymentQuote(
    quoteRef: quoteRef,
    idempotencyKey: idempotencyKey,
    debitAmount: debitAmount?.toDomain(),
    expectedSettlementAmount: expectedSettlementAmount?.toDomain(),
    expectedFeeTotal: expectedFeeTotal?.toDomain(),
    feeLines: feeLines?.map((line) => line.toDomain()).toList(),
    networkFee: networkFee?.toDomain(),
    fxQuote: fxQuote?.toDomain(),
  );
}

extension PaymentQuoteMapper on PaymentQuote {
  PaymentQuoteDTO toDTO() => PaymentQuoteDTO(
    quoteRef: quoteRef,
    debitAmount: debitAmount?.toDTO(),
    expectedSettlementAmount: expectedSettlementAmount?.toDTO(),
    expectedFeeTotal: expectedFeeTotal?.toDTO(),
    feeLines: feeLines?.map((line) => line.toDTO()).toList(),
    networkFee: networkFee?.toDTO(),
    fxQuote: fxQuote?.toDTO(),
  );
}
