'use client';

/**
 * 생산량 합계 섹션
 *
 * SUS(7.93g/cm3) + EGI(7.85g/cm3) 무게 합계
 */

import type { ProductionSummary } from './types';

interface ProductionSummarySectionProps {
  summary: ProductionSummary;
}

export function ProductionSummarySection({ summary }: ProductionSummarySectionProps) {
  return (
    <div className="mb-6">
      <table className="w-full border-collapse text-xs">
        <thead>
          <tr className="bg-gray-100">
            <th className="border border-gray-400 px-3 py-2">생산량 합계 [kg]</th>
            <th className="border border-gray-400 px-3 py-2">SUS</th>
            <th className="border border-gray-400 px-3 py-2">EGI</th>
            <th className="border border-gray-400 px-3 py-2">합계</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td className="border border-gray-400 px-3 py-2 text-center font-medium">무게</td>
            <td className="border border-gray-400 px-3 py-2 text-center">
              {summary.susTotal > 0 ? `${summary.susTotal.toFixed(2)} kg` : '-'}
            </td>
            <td className="border border-gray-400 px-3 py-2 text-center">
              {summary.egiTotal > 0 ? `${summary.egiTotal.toFixed(2)} kg` : '-'}
            </td>
            <td className="border border-gray-400 px-3 py-2 text-center font-bold">
              {summary.grandTotal > 0 ? `${summary.grandTotal.toFixed(2)} kg` : '-'}
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  );
}
