const buildAddFixedPriceItemRequestXML = (itemDetails) => {
  // Constructing the XML payload using template literals
  return `<?xml version="1.0" encoding="utf-8"?>
  <AddFixedPriceItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
    <RequesterCredentials>
      <eBayAuthToken>${itemDetails.userToken}</eBayAuthToken>
    </RequesterCredentials>
    <Item>
      <Title>${itemDetails.title}</Title>
      <Description><${itemDetails.description}></Description>
      <PrimaryCategory>
        <CategoryID>${itemDetails.categoryID}</CategoryID>
      </PrimaryCategory>
      <StartPrice>${itemDetails.startPrice}</StartPrice>
      <ConditionID>${itemDetails.conditionID}</ConditionID>
      <Country>${itemDetails.country}</Country>
      <Currency>${itemDetails.currency}</Currency>
      <DispatchTimeMax>${itemDetails.dispatchTimeMax}</DispatchTimeMax>
      <ListingDuration>${itemDetails.listingDuration}</ListingDuration>
      <ListingType>${itemDetails.listingType}</ListingType>
      <PaymentMethods>
      <PaymentMethod>${
        itemDetails.paymentMethods
          ? itemDetails.paymentMethods[0]
          : "DefaultPaymentMethod"
      }</PaymentMethod>
    </PaymentMethods>
    
      <PayPalEmailAddress>${itemDetails.payPalEmailAddress}</PayPalEmailAddress>
      <PictureDetails>
        <PictureURL>${itemDetails.imageURLs}</PictureURL>
      </PictureDetails>
      <PostalCode>${itemDetails.postalCode}</PostalCode>
      <Quantity>${itemDetails.quantity}</Quantity>
      <ReturnPolicy>
        <ReturnsAcceptedOption>${
          itemDetails.returnsAcceptedOption
        }</ReturnsAcceptedOption>
        <RefundOption>${itemDetails.refundOption}</RefundOption>
        <ReturnsWithinOption>${
          itemDetails.returnsWithinOption
        }</ReturnsWithinOption>
        <Description>${itemDetails.returnPolicyDescription}</Description>
        <ShippingCostPaidByOption>${
          itemDetails.shippingCostPaidByOption
        }</ShippingCostPaidByOption>
      </ReturnPolicy>
      <ShippingDetails>
        <ShippingType>${itemDetails.shippingType}</ShippingType>
        <ShippingServiceOptions>
          <ShippingServicePriority>1</ShippingServicePriority>
          <ShippingService>${itemDetails.shippingService}</ShippingService>
          <ShippingServiceCost>${
            itemDetails.shippingServiceCost
          }</ShippingServiceCost>
        </ShippingServiceOptions>
      </ShippingDetails>
      <Site>${itemDetails.site}</Site>
    </Item>
  </AddFixedPriceItemRequest>`;
};

export default buildAddFixedPriceItemRequestXML;
