import { create } from 'zustand';
import { useTerminalStore } from './terminalStore';
import { useSessionFilesStore } from './sessionFilesStore';
import { useResearchStore } from './researchStore';
import { useSettingsStore } from './settingsStore';
export const useGitStore = create((set) => ({
    // Initial state
    isExpanded: false,
    activeSessionId: null,
    selectedFile: null,
    selectedFileStaged: false,
    isDiffOpen: false,
    isCommitModalOpen: false,
    commitSessionId: null,
    wasSessionListCollapsed: false,
    // Sidebar actions
    toggleSidebar: () => {
        set((state) => {
            const newExpanded = !state.isExpanded;
            if (newExpanded) {
                useTerminalStore.getState().collapseSidebar();
                useSessionFilesStore.getState().collapseSidebar();
                useResearchStore.getState().collapseSidebar();
                useSettingsStore.getState().collapseSidebar();
            }
            return { isExpanded: newExpanded };
        });
    },
    expandSidebar: () => set({ isExpanded: true }),
    collapseSidebar: () => set({ isExpanded: false, isDiffOpen: false, selectedFile: null }),
    // Diff panel actions
    openDiff: (file, staged) => set({
        selectedFile: file,
        selectedFileStaged: staged,
        isDiffOpen: true,
        isExpanded: true,
    }),
    closeDiff: () => set({
        isDiffOpen: false,
        selectedFile: null,
    }),
    switchFile: (file, staged) => set({
        selectedFile: file,
        selectedFileStaged: staged,
    }),
    // Commit modal actions
    openCommitModal: () => set((state) => ({
        isCommitModalOpen: true,
        commitSessionId: state.activeSessionId,
    })),
    openCommitModalForSession: (sessionId) => set({ isCommitModalOpen: true, commitSessionId: sessionId }),
    closeCommitModal: () => set({ isCommitModalOpen: false, commitSessionId: null }),
    // Session list collapse
    setActiveSessionId: (sessionId) => set({ activeSessionId: sessionId }),
    setSessionListCollapsed: (collapsed) => set({ wasSessionListCollapsed: collapsed }),
}));
//# sourceMappingURL=gitStore.js.map