import { v4 as uuidv4 } from 'uuid';
import { t } from 'i18next';
import { getUniqueName } from '../../../../../../../../../utils/get-unique-name';
import { addValue } from '../../../../../../../../commands';
import { PICK_MODE } from '../../const';
export const addSubstate = (destinationPath) => (dispatch, getState) => {
    const destination = getState(destinationPath);
    const state = getState(destinationPath.slice(0, -1));
    dispatch(addValue(destinationPath, {
        id: uuidv4(),
        name: getUniqueName(t('components.animatable.editor.substate.new.title'), destination),
        timeline: {
            frames: [],
            looped: false,
        },
        x: 0,
        y: state.pickMode === PICK_MODE.TWO_DIMENSIONAL ? 0 : undefined,
    }));
};
