import { IInvoiceParticipant } from "@/contexts/invoicing/domain";
import { IListInvoice_Participant_Response_DTO } from "@shared/contexts";
import { InvoiceParticipantAddressPresenter } from "./InvoiceParticipantAddress.presenter";

export const InvoiceParticipantPresenter = (
  participant: IInvoiceParticipant,
): IListInvoice_Participant_Response_DTO => {
  return {
    participant_id: participant?.id?.toString(),
    tin: participant?.tin?.toString(),
    first_name: participant?.firstName?.toString(),
    last_name: participant?.lastName?.toString(),
    company_name: participant?.companyName?.toString(),

    billing_address: InvoiceParticipantAddressPresenter(
      participant?.billingAddress!,
    ),
    shipping_address: InvoiceParticipantAddressPresenter(
      participant?.shippingAddress!,
    ),
  };
};
