/**
 * 财务指标 Tab
 */

import React from 'react';
import { FinancialMetricsTable } from '../components';
import type { FinancialMetricsData } from '../types';

export interface FinancialMetricsTabProps {
  financialMetrics: FinancialMetricsData[];
  showMetricChart: (name: string, key: string, data: unknown[], path: string) => void;
  calculateYoYChange: (value: number, period: string, data: unknown[], path: string) => { change: number; intensity: number };
  getCellBackground: (change: number, intensity: number) => string;
  positiveColor: string;
  negativeColor: string;
  bgColor: string;
  hoverBg: string;
}

const FinancialMetricsTab: React.FC<FinancialMetricsTabProps> = ({
  financialMetrics,
  showMetricChart,
  calculateYoYChange,
  getCellBackground,
  positiveColor,
  negativeColor,
  bgColor,
  hoverBg,
}) => {
  const tableProps = {
    showMetricChart,
    calculateYoYChange,
    getCellBackground,
    positiveColor,
    negativeColor,
    bgColor,
    hoverBg,
  };

  return (
    <FinancialMetricsTable data={financialMetrics} {...tableProps} />
  );
};

export default FinancialMetricsTab;
