import { LegacyPromoProperties } from "../legacyLoggerFunctions";
import { PromoProperties } from "../typings";

/**
 * Maps LegacyPromoProperties to PromoProperties
 * @param legacyProperties - The legacy promo properties
 * @returns The new promo properties format
 */
export const promoPropertiesMapper = (
  legacyProperties: LegacyPromoProperties
): PromoProperties => {
  return {
    promo_id: legacyProperties.id,
    action: legacyProperties.action,
    items_list: legacyProperties.items.map((item) => item.id),
    title: legacyProperties.title,
    type: legacyProperties.type,
    meta: legacyProperties.meta,
  };
};
