import { request, METHOD, formatObj } from '@/utils';
import Lang from '@/utils/langUtils';
export * from './menu';
export * from './system';
export * from './task';
export * from './xunjian';

export function getUserDetailInfoApi() {
    return request('/api/v1/detail', METHOD.GET);
}
export const getStaticParam = async (staticKey) => {
    const res = await request('/api/v1/parameters/business/multi/list', METHOD.GET, {
        queryList: staticKey,
    });
    const curData = res.find((i) => i.key === staticKey);
    const newData = await formatObj(curData.businessParameterList || [], {
        value: 'paramValue',
        label: 'paramName',
        key: 'paramId',
    });
    return newData;
};

export const getStaticDataApi = async (data) => {
    const res = await request('/api/v1/parameters/business/list', METHOD.GET, {
        ...data,
        paramLocale: Lang.get(),
    });
    const newData = await formatObj(res || [], {
        value: 'paramValue',
        label: 'paramName',
        key: 'paramId',
    });
    return newData;
};

export function getStaticDataByTwoParamsApi(paramModule, paramCode) {
    return getStaticDataApi({ paramModule, paramCode });
}
