import { create } from 'zustand';

interface EvaluationTaskHistoryState {
    listLoading: boolean;
    historyList: any[];
}

interface EvaluationTaskHistoryActions {
    setListLoading: (loading: boolean) => void;
    setHistoryList: (list: any[]) => void;
}

export type EvaluationTaskHistoryStore = EvaluationTaskHistoryState & EvaluationTaskHistoryActions & {
    fetchEvaluationTaskHistory: (taskId: string) => Promise<void>;
};

export const useEvaluationTaskHistoryStore = create<EvaluationTaskHistoryStore>((set) => ({
    listLoading: false,
    historyList: [],
    
    setListLoading: (loading) => set({ listLoading: loading }),
    
    setHistoryList: (list) => set({ historyList: list }),
    
    fetchEvaluationTaskHistory: async (taskId: string) => {
        set({ listLoading: true });
        try {
            // TODO: 调用 API 获取评估任务历史
            set({ historyList: [] });
        } catch (error) {
            console.error('获取评估任务历史失败:', error);
        } finally {
            set({ listLoading: false });
        }
    },
}));

export default useEvaluationTaskHistoryStore;
