"use client";


import ModalFooter from "@/components/ui/modal/ModalFooter";
import ModalBody from "@/components/ui/modal/ModalBody";
import ModalHeader from "@/components/ui/modal/ModalHeader";
import Modal from "@/components/ui/modal/Modal";
import { useState } from "react";



interface Props {

    onClose: () => void;
    title?: string;
}

export default function ShareholdingCompute({
    onClose,
    title = "Shareholding History",
}: Props) {
    const [globalError, setGlobalError] = useState("");
    return (
        <Modal onClose={onClose} isOpen={true}>
            <ModalHeader
                title={title}
                subtitle=""
                onClose={onClose}
            />
            <ModalBody>
                <div className="overflow-x-auto border border-gray-200 rounded-lg">
                    <table className="w-full text-[11px]">
                        <thead className="bg-gray-100 border-b">
                            <tr>
                                <th className="px-3 py-2 text-left font-semibold text-gray-600">
                                    #
                                </th>

                                <th className="px-3 py-2 text-left font-semibold text-gray-600">
                                    Shareholder Name
                                </th>

                                <th className="px-3 py-2 text-left font-semibold text-gray-600">
                                    Category
                                </th>

                                <th className="px-3 py-2 text-right font-semibold text-gray-600">
                                    Ultimate %
                                </th>

                                <th className="px-3 py-2 text-center font-semibold text-gray-600">
                                    SBO
                                </th>
                            </tr>
                        </thead>

                        <tbody>
                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">01</td>
                                <td className="px-3 py-2">Vikram Sethi</td>
                                <td className="px-3 py-2">Founder</td>
                                <td className="px-3 py-2 text-right">50.501%</td>
                                <td className="px-3 py-2 text-center">✓</td>
                            </tr>

                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">02</td>
                                <td className="px-3 py-2">Anita Sethi</td>
                                <td className="px-3 py-2">Family Member</td>
                                <td className="px-3 py-2 text-right">20.499%</td>
                                <td className="px-3 py-2 text-center">✓</td>
                            </tr>

                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">03</td>
                                <td className="px-3 py-2">Rohan Sethi</td>
                                <td className="px-3 py-2">Beneficiary</td>
                                <td className="px-3 py-2 text-right">3.999%</td>
                                <td className="px-3 py-2 text-center">✓</td>
                            </tr>

                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">04</td>
                                <td className="px-3 py-2">Nexus India Fund IV</td>
                                <td className="px-3 py-2">Fund</td>
                                <td className="px-3 py-2 text-right">12.001%</td>
                                <td className="px-3 py-2 text-center">-</td>
                            </tr>

                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">05</td>
                                <td className="px-3 py-2">Nexus Opportunity Fund</td>
                                <td className="px-3 py-2">Co-Investor</td>
                                <td className="px-3 py-2 text-right">4.000%</td>
                                <td className="px-3 py-2 text-center">-</td>
                            </tr>

                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">06</td>
                                <td className="px-3 py-2">Angel Investors Pool</td>
                                <td className="px-3 py-2">Syndicate</td>
                                <td className="px-3 py-2 text-right">2.000%</td>
                                <td className="px-3 py-2 text-center">-</td>
                            </tr>

                            <tr className="border-t hover:bg-gray-50">
                                <td className="px-3 py-2">07</td>
                                <td className="px-3 py-2">Public / Other</td>
                                <td className="px-3 py-2">Public</td>
                                <td className="px-3 py-2 text-right">7.000%</td>
                                <td className="px-3 py-2 text-center">-</td>
                            </tr>

                            <tr className="border-t bg-gray-50 font-semibold">
                                <td colSpan={3} className="px-3 py-2">
                                    Total
                                </td>
                                <td className="px-3 py-2 text-right">100%</td>
                                <td></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </ModalBody>
            <ModalFooter globalError={globalError} onClose={onClose} />
        </Modal>
    );
}
