/*
*
* */
import {useUserStore} from "@/hooks/useUserStore";
import {useCacheStore} from "@/hooks/useCacheStore";
import {cacheActions} from "@/hooks/defineCacheActions";
import _ from "lodash";
import {conditionSharedConfig} from "@/components/mx-condition/modules/conditionSharedConfig";

export const useConditionPaperType = function (options = {}) {
    const {isCultural} = useUserStore()
    const {dispatchCache} = useCacheStore()

    return {
        ...conditionSharedConfig,
        handler: async () => {
            const result = await dispatchCache(cacheActions.getDicts, 'paper_type')
            const source = [...result] // 创建source副本
            // TODO：注意跟进，现在`必刷题`只提供给河南的职高对口
            if (!isCultural.value) _.remove(source, i => i.dictValue == '必刷题')
            return source
        },
        key: 'paperType',
        title: '做题类型',
        keyName: 'dictLabel',
        keyValue: 'dictValue',
        ...options
    }
}