'use client';

import { Moon, ShieldAlert, Banknote, FileWarning, Wine } from 'lucide-react';
import { AmountCardItem, CheckPointItem, CollapsibleDashboardCard, type SectionColorTheme } from '../components';
import type { EntertainmentData } from '../types';

// 카드별 아이콘 매핑 (주말/심야, 기피업종, 고액결제, 증빙미비)
const CARD_ICONS = [Moon, ShieldAlert, Banknote, FileWarning];
const CARD_THEMES: SectionColorTheme[] = ['purple', 'red', 'orange', 'pink'];

interface EntertainmentSectionProps {
  data: EntertainmentData;
  onCardClick?: (cardId: string) => void;
}

export function EntertainmentSection({ data, onCardClick }: EntertainmentSectionProps) {
  return (
    <CollapsibleDashboardCard
      icon={<Wine style={{ color: '#ffffff' }} className="h-5 w-5" />}
      title="접대비 현황"
      subtitle="접대비 사용 현황"
    >
      <div className="grid grid-cols-1 xs:grid-cols-2 md:grid-cols-4 gap-3 xs:gap-4 mb-4">
        {data.cards.map((card, idx) => (
          <AmountCardItem
            key={card.id}
            card={card}
            onClick={() => onCardClick?.(card.id)}
            icon={CARD_ICONS[idx] || Wine}
            colorTheme={CARD_THEMES[idx] || 'pink'}
            showTrend={!!card.previousLabel}
            trendValue={card.previousLabel}
            trendDirection="up"
          />
        ))}
      </div>

      {data.checkPoints.length > 0 && (
        <div className="border-t pt-4 space-y-1">
          {data.checkPoints.map((cp) => (
            <CheckPointItem key={cp.id} checkpoint={cp} />
          ))}
        </div>
      )}
    </CollapsibleDashboardCard>
  );
}
