import type { BaseEcommerceEvent } from 'src/application/models';

/**
 * Checks if an event is a base Google Analytics ecommerce event.
 *
 * @param data The event to check.
 *
 * @returns True if the event is a base ecommerce event, false otherwise.
 */
export const isBaseEcommerceEvent = (data: unknown): data is BaseEcommerceEvent =>
  data != null &&
  typeof data === 'object' &&
  'ecommerce' in data &&
  data.ecommerce != null &&
  typeof data.ecommerce === 'object' &&
  'event' in data &&
  typeof data.event === 'string';
