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

/**
 * 查询ota升级列表
 * @param param
 */
export async function queryOtaList(param: object) {
  return request(`/web/v1/ota?${stringify(param)}`);
}

/**
 * 删除ota升级
 * @param record_id
 */
export async function delOta(record_id: any) {
  return request(`/web/v1/ota/${record_id}`, {
    method: 'DELETE',
  });
}

/**
 * 编辑ota
 * @param params
 */
export async function editOta(params: any) {
  return request(`/web/v1/ota/${params.record_id}`, {
    method: 'PUT',
    data: params,
  });
}

/**
 *  新增ota
 * @param params
 */
export async function createOta(params: object) {
  return request(`/web/v1/ota`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 查询设备列表
 * @param param
 */
export async function queryDeviceList(param: object) {
  return request(`/web/v1/device_types?${stringify(param)}`);
}
