import createAxios from '@/utils/request'

//登录获取token
export function getRouteMenu() {
    return createAxios({
        url: '/user-boot/function/getRouteMenu'
    })
}

export const getModelPage = async (params: any) => {
    return await createAxios({ url: '/bpm/model/page', params, method: 'get' })
}

export const getModel = async (id: number) => {
    return await createAxios({ url: '/bpm/model/get?id=' + id, method: 'get' })
}

export const updateModel = async (data: any) => {
    return await createAxios({ url: '/bpm/model/update', method: 'put', data: data })
}

// 任务状态修改
export const updateModelState = async (id: number, state: number) => {
    const data = {
        id: id,
        state: state
    }
    return await createAxios({ url: '/bpm/model/update-state', method: 'put', data: data })
}

export const createModel = async data => {
    return await createAxios({ url: '/bpm/model/create', method: 'POST', data: data })
}

export const deleteModel = async (id: number) => {
    return await createAxios({ url: '/bpm/model/delete?id=' + id, method: 'DELETE' })
}

export const deployModel = async (id: number) => {
    return await createAxios({ url: '/bpm/model/deploy?id=' + id, method: 'POST' })
}
