import request from '@/utils/request';

// 查询场景联动列表
export function listScene(query) {
    return request({
        url: '/iot/scene/list',
        method: 'get',
        params: query,
    });
}

// 查询场景联动详细
export function getScene(sceneId) {
    return request({
        url: '/iot/scene/' + sceneId,
        method: 'get',
    });
}

// 新增场景联动
export function addScene(data) {
    return request({
        url: '/iot/scene',
        method: 'post',
        data: data,
    });
}

// 修改场景联动
export function updateScene(data) {
    return request({
        url: '/iot/scene',
        method: 'put',
        data: data,
    });
}

// 删除场景联动
export function delScene(sceneId) {
    return request({
        url: '/iot/scene/' + sceneId,
        method: 'delete',
    });
}

// 执行场景
export function runScene(query) {
    return request({
        url: '/iot/runtime/runScene',
        method: 'post',
        params: query,
    });
}

export function openPublishLog(chainName) {
  return request({
    url: '/iot/scene/log/open/' + chainName,
    method: 'get',
  });
}
export function closePublishLog(chainName) {
  return request({
    url: '/iot/scene/log/close/' + chainName,
    method: 'get',
  });
}

export function getEnergyType(query) {
    return request({
        url: '/iot/scene/getEnergyType',
        method: 'get',
        params: query,
    });
}
