/**
 * Product Card Component
 * Generic product card that adapts to different product types
 */

import React from 'react';
import type { MarketplaceProductListItem } from '../../../types/marketplace.types';
import { SignalPackCard } from './SignalPackCard';
import { AdvisoryCard } from './AdvisoryCard';
import { CourseProductCard } from './CourseProductCard';

interface ProductCardProps {
  product: MarketplaceProductListItem;
  onAction?: (productId: string) => void;
}

export const ProductCard: React.FC<ProductCardProps> = ({ product, onAction }) => {
  switch (product.productType) {
    case 'signals':
      return <SignalPackCard pack={product} onSubscribe={onAction} />;
    case 'advisory':
      return <AdvisoryCard advisory={product} onBook={onAction} />;
    case 'courses':
      return <CourseProductCard course={product} onEnroll={onAction} />;
    default:
      return <SignalPackCard pack={product} onSubscribe={onAction} />;
  }
};

export default ProductCard;
