import { useCallback } from "react";
import { useMaterialStore } from "../../../../../store/simulation/useMaterialStore";

export function useDefaultHandler() {
    const { getMaterialById } = useMaterialStore();

    const defaultLogStatus = (materialUuid: string, status: string) => {
        // console.log(`${materialUuid}, ${status}`);
    }

    const handleDefault = useCallback((action: ConveyorAction, materialId?: string) => {
        if (!action || action.actionType !== 'default' || !materialId) return;

        const material = getMaterialById(materialId);
        if (!material) return;

        defaultLogStatus(material.materialId, `performed Default action`);

    }, [getMaterialById]);

    return {
        handleDefault,
    };
}