import { mountStoreDevtool } from 'simple-zustand-devtools';
import { create } from 'zustand';
import { devtools } from 'zustand/middleware';

const useVideoEditorStore = create(
    devtools((set, get) => ({
        videoIsPlaying: false,
        selectedTextElement: null,

        setVideoIsPlaying: (isPlaying) => {
            set({ videoIsPlaying: isPlaying });
        },

        setSelectedTextElement: (element) => {
            set({ selectedTextElement: element });
        },
    })),

    {
        name: 'VideoEditorStore',
        store: 'VideoEditorStore',
    },
);

if (import.meta.env.APP_ENV === 'local') {
    mountStoreDevtool('VideoEditorStore', useVideoEditorStore);
}

export default useVideoEditorStore;
