import 'package:pshared/data/dto/payment/payment_quote.dart';
import 'package:pshared/data/mapper/payment/fx_quote.dart';
import 'package:pshared/data/mapper/payment/quote/amounts.dart';
import 'package:pshared/data/mapper/payment/quote/fees.dart';
import 'package:pshared/models/payment/quote/quote.dart';

extension PaymentQuoteDTOMapper on PaymentQuoteDTO {
  PaymentQuote toDomain({String? idempotencyKey}) => PaymentQuote(
    quoteRef: quoteRef,
    intentRef: intentRef,
    idempotencyKey: idempotencyKey,
    amounts: amounts?.toDomain(),
    fees: fees?.toDomain(),
    fxQuote: fxQuote?.toDomain(),
  );
}

extension PaymentQuoteMapper on PaymentQuote {
  PaymentQuoteDTO toDTO() => PaymentQuoteDTO(
    quoteRef: quoteRef,
    intentRef: intentRef,
    amounts: amounts?.toDTO(),
    fees: fees?.toDTO(),
    fxQuote: fxQuote?.toDTO(),
  );
}
