import { Profile } from "@/contexts/profile/domain";
import { IProfileContext } from "@/contexts/profile/infrastructure/Profile.context";
import { IUpdateProfileResponse_DTO } from "@shared/contexts";

export interface IUpdateProfilePresenter {
  map: (profile: Profile, context: IProfileContext) => IUpdateProfileResponse_DTO;
}

export const UpdateProfilePresenter: IUpdateProfilePresenter = {
  map: (profile: Profile, context: IProfileContext): IUpdateProfileResponse_DTO => {
    return {
      dealer_id: profile.id.toString(),
      contact_information: profile.contactInformation.toString(),
      default_payment_method: profile.defaultPaymentMethod.toString(),
      default_notes: profile.defaultNotes.toString(),
      default_legal_terms: profile.defaultLegalTerms.toString(),
      default_quote_validity: profile.defaultQuoteValidity.toString(),
      default_tax: profile.defaultTax.convertScale(2).toObject(),
    };
  },
};
