import { useEffect, useCallback } from 'react';

export function useVehicleActions() {

    const handleTravelAction = useCallback((action: VehicleAction) => {
        if (!action || action.actionType !== 'travel') return;

        console.log(`Vehicle travel action ${action.actionUuid}`);

    }, []);

    const handleVehicleAction = useCallback((action: VehicleAction) => {
        if (!action) return;

        switch (action.actionType) {
            case 'travel':
                handleTravelAction(action);
                break;
            default:
                console.warn(`Unknown vehicle action type: ${action.actionType}`);
        }
    }, [handleTravelAction]);

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

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

    return {
        handleVehicleAction,
        cleanup
    };
}