import { Box } from "@mui/material";
import Edit from "./Edit";
import Delete from "./Delete";
import { useAuth } from "@/lib/contexts/auth";
import Add from "./Add";

const RowActions = ({ row, mutate }) => {
    const { user } = useAuth();

    return (
        <Box sx={{ display: "flex", gap: 1 }}>
            {row.original.state_id == 5 && user.id == row.original.user_id && (
                <>
                    <Edit mutate={mutate} row={row} />
                    <Delete mutate={mutate} rowId={row.original.id} />
                </>
            )}
            {row.original.state_id == 3 && user.id == row.original.user_id && (
                <>
                    <Add mutate={mutate} row={row} />
                </>
            )}
        </Box>
    );
};
export default RowActions;
