import 'package:pshared/data/dto/payment/quotes.dart';
import 'package:pshared/data/mapper/payment/quote.dart';
import 'package:pshared/models/payment/quote/quotes.dart';

extension PaymentQuotesDTOMapper on PaymentQuotesDTO {
  PaymentQuotes toDomain({String? idempotencyKey}) => PaymentQuotes(
    quoteRef: quoteRef,
    idempotencyKey: idempotencyKey ?? this.idempotencyKey,
    items: items?.map((quote) => quote.toDomain()).toList(),
  );
}

extension PaymentQuotesMapper on PaymentQuotes {
  PaymentQuotesDTO toDTO() => PaymentQuotesDTO(
    quoteRef: quoteRef,
    idempotencyKey: idempotencyKey,
    items: items?.map((quote) => quote.toDTO()).toList(),
  );
}
