import { useEffect, useCallback } from 'react';

export function useRoboticArmActions() {

    const handlePickAndPlace = useCallback((action: RoboticArmAction) => {
        console.log(`Robotic arm pick and place`);
    }, []);

    const handleRoboticArmAction = useCallback((action: RoboticArmAction) => {
        switch (action.actionType) {
            case 'pickAndPlace':
                handlePickAndPlace(action);
                break;
            default:
                console.warn(`Unknown robotic arm action type: ${action.actionType}`);
        }
    }, [handlePickAndPlace]);

    const cleanup = useCallback(() => {
    }, []);

    useEffect(() => {
        return () => {
            cleanup();
        };
    }, [cleanup]);

    return {
        handleRoboticArmAction,
        cleanup
    };
}