import { DialogContent } from "@mui/material";
import ComputePaymentForm from "./Forms/ComputePaymentForm";
import ConfirmFileForm from "./Forms/ConfirmFileForm";
import ConfirmRequestForm from "./Forms/ConfirmRequestForm";
import ReferForm from "./Forms/ReferForm";
import RejectFileForm from "./Forms/RejectFileForm";
import RejectRequestForm from "./Forms/RejectRequestForm";

export default function RenderActionForm({ type, rowData, mutate, onClose }) {
    const formType = `${type}_${rowData?.state_id}`;

    function renderForm() {
        switch (formType) {
            case "refer_request_2":
                return <ReferForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
            case "reject_request_2":
                return <RejectRequestForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
            case "reject_request_5":
                return <RejectFileForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
            case "confirm_request_2":
                return <ConfirmRequestForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
            case "confirm_request_5":
                return <ConfirmFileForm mutate={mutate} onClose={onClose} rowId={rowData.id} />;
            case "confirm_request_13":
                return <ComputePaymentForm mutate={mutate} onClose={onClose} rowData={rowData} />;
            default:
                return <></>;
        }
    }

    return <DialogContent>{renderForm()}</DialogContent>;
}
