//import { LstCard } from "@/components/extendedUI/LstCard";
import { getinventoryCheck } from "@/utils/querys/logistics/getInventoryCheck";
import { invColumns } from "@/utils/tableData/InventoryCards/inventoryColumns";
import { InvTable } from "@/utils/tableData/InventoryCards/inventoryData";

import { useQuery } from "@tanstack/react-query";
//import { CircleX } from "lucide-react";
//import { Suspense } from "react";
//import { toast } from "sonner";

export default function INVCheckCard(props: any) {
    //{ style = {} }
    const { data, isError, isLoading } = useQuery(getinventoryCheck(props));

    if (isLoading) return <div>Loading inventory data...</div>;
    if (isError) {
        return (
            <div>
                <p>There was an error getting the inv.</p>
            </div>
        );
    }
    let laneData: any = data;
    if (props.type != "") {
        laneData = laneData.filter(
            (l: any) => l.rowType === props.type.toUpperCase()
        );

        // age
        laneData = laneData.filter((l: any) => l.DaysSinceLast >= props.age);
    }

    // const handleCloseCard = () => {
    //     //removeCard("PPOO");

    //     toast.success("card removed");
    // };

    return <InvTable columns={invColumns} data={laneData} info={props} />;
}
