import { request } from '@@/plugin-request/request';
import { stringify } from 'qs';

/**
 * 家列表数据
 * @param param
 */
export async function queryHomeList(param: object) {
  return request(`/web/v1/homes?${stringify(param)}`);
}

/**
 * 房间列表数据
 * @param param
 */
export async function queryRoomList(param: object) {
  return request(`/web/v1/rooms?${stringify(param)}`);
}

/**
 * 下发参数
 * @param params
 */
export async function overwriteData(params: object) {
  return request(`/web/v1/control/fan_voltage`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 更新地区名称
 * @param params
 * @param record_id
 */
export async function updateArea(params: object, record_id: string) {
  return request(`/web/v1/homes/address/${record_id}`, {
    method: 'PUT',
    data: params,
  });
}
