import request from './request';

/**
 * 设备列表：后端已支持服务端分页与筛选。
 */
export const getDevices = (params) => {
  return request.get('/b/devices', { params });
};

export const getDeviceById = (id) => {
  return request.get(`/b/devices/${id}`);
};

export const getImplantCatalogs = (params) => {
  return request.get('/b/devices/catalogs', { params });
};

export const createImplantCatalog = (data) => {
  return request.post('/b/devices/catalogs', data);
};

export const updateImplantCatalog = (id, data) => {
  return request.patch(`/b/devices/catalogs/${id}`, data);
};

export const deleteImplantCatalog = (id) => {
  return request.delete(`/b/devices/catalogs/${id}`);
};

export const createDevice = (data) => {
  return request.post('/b/devices', data);
};

export const updateDevice = (id, data) => {
  return request.patch(`/b/devices/${id}`, data);
};

export const deleteDevice = (id) => {
  return request.delete(`/b/devices/${id}`);
};
