import { request } from "./request";
// 新建:
const addDeclareBill = (params) => {
  return request("/worn/declareBill/add", params, "POST");
};
// 当前用户仓库列表
const warehouseList = (params) => {
  return request("/home/warehouse/list", params, "get");
};
const listMqttDevice = (params) => {
  return request("/worn/mqttDevice/list", params, "get");
};
const listMqttData = (params) => {
  return request("/worn/mqttData/list", params, "get");
};
const listMqttEvent = (params) => {
  return request("/worn/mqttEvent/list", params, "get");
};
// 智能排风远程开关
const controlSocket = (data) => {
  console.log(data,'controlSocket==>');
  
  const payload = {
    devEui: data.devEui,
    deviceId: data.deviceId,
    status: data.status,
  };
  return request(`/worn/socket/control?devEui=${payload.devEui}&deviceId=${payload.deviceId}&status=${payload.status}`, payload, "post");
};

// 智慧照明开关远程控制
const controlLightSwitch = (data) => {
  const payload = {
    devEui: data.devEui,
    channel: data.channel,
    status: data.status,
  };
  return request(
    `/worn/socket/switch?devEui=${payload.devEui}&channel=${payload.channel}&status=${payload.status}`,
    payload,
    "post",
  );
};

export {
  warehouseList,
  controlLightSwitch,
  listMqttDevice,
  listMqttData,
  listMqttEvent,
  controlSocket,
};
