"use client";
import { convertDaysToWorkingWeeks, formatNumber } from "@/app/utils";

export default function WorksPackageCard({
  totalEstimatedCost,
  totalLabourDays,
  totalFunding,
}: {
  totalEstimatedCost: number;
  totalLabourDays: number;
  totalFunding: number | null;
}) {
  return (
    <table className="text-left bg-brandblue rounded-md text-gray-100 w-full border-separate border-spacing-0">
      <tbody>
        <tr>
          <td colSpan={2} className="px-4 pt-4 pb-2 font-semibold text-base">
            Works Package
          </td>
        </tr>

        {/* Divider row */}
        <tr>
          <td colSpan={2}>
            <div className="h-[2px] bg-brandbrown mx-4 rounded-sm" />
          </td>
        </tr>

        <tr>
          <td className="font-semibold px-4 py-2">Total Cost:</td>
          <td className="pr-4 font-bold">{"£" + formatNumber(totalEstimatedCost)}</td>
        </tr>

        <tr>
          <td className="font-semibold px-4 py-2">Total Funding:</td>
          <td className="pr-4 font-bold">{"£" + formatNumber(totalFunding || 0)}</td>
        </tr>

        <tr>
          <td className="font-semibold px-4 py-2">Estimated Duration:</td>
          <td className="pr-4 font-bold">{convertDaysToWorkingWeeks(totalLabourDays)}</td>
        </tr>
      </tbody>
    </table>
  );
}


