import { GstEntry } from "@/types"
import { fmtDate } from "@/utils"

export default function GstSection({
    gstEntries
}:{
    gstEntries: GstEntry[]
}){
return(
     <>
     {gstEntries.length === 0 ? (
            <p className="text-sm text-gray-400">No GST registrations on record.</p>
          ) : (
            <div className="overflow-x-auto rounded-xl border border-gray-100">
              <table className="w-full text-sm">
                <thead>
                  <tr className="bg-gray-50 border-b border-gray-100">
                    {['State', 'GSTIN', 'Registration Date'].map(h => (
                      <th key={h} className="py-2.5 px-4 text-left text-[11px] font-semibold text-gray-500 uppercase tracking-wide">{h}</th>
                    ))}
                  </tr>
                </thead>
                <tbody>
                  {gstEntries.map((row, i) => (
                    <tr key={i} className="border-b border-gray-100 last:border-0 hover:bg-gray-50 transition-colors">
                      <td className="py-2.5 px-4 font-medium text-gray-800">{row.state || '—'}</td>
                      <td className="py-2.5 px-4 font-mono text-xs text-gray-700">{row.gstin}</td>
                      <td className="py-2.5 px-4 text-gray-600">{fmtDate(row.regDate)}</td>
                    </tr>
                  ))}
                </tbody>
              </table>
            </div>
          )}
     </>
)
}