import { create } from 'zustand';

interface KnowledgeDetailComponentState {
    sliceId: string;
    sliceText: string;
    loading: boolean;
}

interface KnowledgeDetailComponentActions {
    setSliceId: (id: string) => void;
    setSliceText: (text: string) => void;
    setLoading: (loading: boolean) => void;
}

export type KnowledgeDetailComponentStore = KnowledgeDetailComponentState & KnowledgeDetailComponentActions;

export const useKnowledgeDetailComponentStore = create<KnowledgeDetailComponentStore>((set) => ({
    sliceId: '',
    sliceText: '',
    loading: false,
    
    setSliceId: (id) => set({ sliceId: id }),
    
    setSliceText: (text) => set({ sliceText: text }),
    
    setLoading: (loading) => set({ loading }),
}));

export default useKnowledgeDetailComponentStore;
