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

/**
 * 查询码库列表数据
 * @param param
 */
export async function queryInfraredRemote(param: object) {
  return request(`/web/v1/infrared_remote_index?${stringify(param)}`);
}

/**
 * 删除红外码库
 * @param record_id
 */
export async function delInfraredRemote(record_id: any) {
  return request(`/web/v1/infrared_remote_index/${record_id}`, {
    method: 'DELETE',
  });
}

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

/**
 * 编辑码库
 * @param params
 */
export async function updateInfraredRemote(params: { record_id: string }) {
  return request(`/web/v1/infrared_remote_index/${params.record_id}`, {
    method: 'PUT',
    data: params,
  });
}
