import { useAjax } from '@/Hook/useAjax'
import { getAccApi, getOrientApi, setPromotionPageAjax, getLayoutLocalApi, delLayoutLocalApi,
    delAdPlanLocalApi, getPlanActionRecordApi, createAd, getAdWechatServiceNameApi, getAdWechatWechatNameApi, 
    getTaskListApi, getScanStatusApi, TaskProps, PlanProps, OrientProps, refreshDataApi } from '@/services/operating/adWeChat'


export default function useWeChat() {
    const getAcc = useAjax(() => getAccApi(), { formatResult: true })
    const getOrient = useAjax((params: OrientProps) => getOrientApi(params), { formatResult: true })
    // const getBookRank = useAjax((params: Params) => bookRank(params), { formatResult: true })
    const setPromotionPage = useAjax((params: { userId: string | number, name: string, typesetting: string }) => setPromotionPageAjax(params), { formatResult: true })
    const getLayoutLocal = useAjax((params: { pageNum: number, pageSize: number, name?: string | undefined, updateStartDate?: string | undefined, updateEndDate?: string | undefined }) => getLayoutLocalApi(params), { formatResult: true })
    const delLayoutLocal = useAjax((params: { userId: string | number, name: string }) => delLayoutLocalApi(params), { formatResult: true })

    const delAdPlanLocal = useAjax((params: { objectName: string, serviceName: string, wechatName: string }) => delAdPlanLocalApi(params), { formatResult: true })
    const getPlanActionRecord = useAjax((params: PlanProps) => getPlanActionRecordApi(params), { formatResult: true })
    const createAdPost = useAjax((params) => createAd(params), { formatResult: true })
    const getAdWechatServiceName = useAjax(() => getAdWechatServiceNameApi(), { formatResult: true })
    const getAdWechatWechatName = useAjax((params: { serviceName: string }) => getAdWechatWechatNameApi(params), { formatResult: true })
    const getTaskList = useAjax((params: TaskProps) => getTaskListApi(params), { formatResult: true })
    const getScanStatus = useAjax(() => getScanStatusApi(), { formatResult: true })
    const refreshData = useAjax((params: {userId: number, is_refresh: string}) => refreshDataApi(params), { formatResult: true })
    return {
        getAcc,
        getOrient,
        setPromotionPage,
        getLayoutLocal,
        delLayoutLocal,
        delAdPlanLocal,
        getPlanActionRecord,
        createAdPost,
        getAdWechatServiceName,
        getAdWechatWechatName,
        getTaskList,
        getScanStatus,
        refreshData
    }
}