import request from '@/utils/request'

// 查询业务对象列表
export function listObj(query) {
    return request({
        url: '/obj/obj/list',
        method: 'get',
        params: query
    })
}

// 查询业务对象详细
export function getObj(objId) {
    return request({
        url: '/obj/obj/' + objId,
        method: 'get'
    })
}

// 新增业务对象
export function addObj(data) {
    return request({
        url: '/obj/obj',
        method: 'post',
        data: data
    })
}

// 修改业务对象
export function updateObj(data) {
    return request({
        url: '/obj/obj',
        method: 'put',
        data: data
    })
}

// 删除业务对象
export function delObj(objId) {
    return request({
        url: '/obj/obj/' + objId,
        method: 'delete'
    })
}

// 添加模板
export function addObjTpl(objId,query) {
    return request({
        url: '/obj/obj/tpl/add/' + objId,
        method: 'get',
        params: query
    })
}

// 删除模板
export function delObjTpl(objId,tplId) {
    return request({
        url: '/obj/obj/tpl/del/' + objId + '/' + tplId,
        method: 'get'
    })
}


// 选择指标
export function selectMetrics(objId) {
    return request({
        url: '/obj/obj/metrics/select/' + objId,
        method: 'get'
    })
}

export function addMetrics(objId,query) {
    return request({
        url: '/obj/obj/metrics/add/' + objId,
        method: 'get',
        params:query
    })
}

export function scheduleObj(objId) {
    return request({
        url: '/obj/obj/schedule/' + objId,
        method: 'get'
    })
}

export function validateObj(query){
    return request({
        url: '/obj/obj/validate',
        method: 'GET',
        params: query
    })
}
