/**
 * Analytics placeholder for add-to-cart events.
 *
 * When the project uses an analytics provider (e.g. GA4, Plausible, Segment),
 * implement trackAddToCart to send an "add_to_cart" event and call it after
 * a successful add in:
 * - PDP: ProductDetailHeroSection, in the addItem().then() callback
 * - Grid: ProductCard / ProductListTile, in the addItem().then() callback (when Phase 3 is implemented)
 */

export type AddToCartSource = "pdp" | "grid";

export type AddToCartAnalyticsPayload = {
  variantId: string;
  quantity: number;
  source: AddToCartSource;
};

/**
 * Fire an "add_to_cart" analytics event. No-op by default.
 * Implement when analytics is enabled (e.g. window.gtag, Plausible, Segment).
 */
export function trackAddToCart(payload: AddToCartAnalyticsPayload): void {
  // Placeholder: no implementation. When analytics is added, e.g.:
  // if (typeof window !== "undefined" && window.gtag) {
  //   window.gtag("event", "add_to_cart", { ... });
  // }
  void payload;
}
