import type { Device, GetDeviceListParams } from './types'
import { defHttp } from '@/utils/http/axios'

export function getDeviceList(params: GetDeviceListParams) {
  return defHttp.get<PageResult<Device>>({
    url: '/device/page',
    params,
  })
}

export function createDevice(data: Partial<Device>) {
  return defHttp.post({
    url: '/device/save',
    data,
  })
}

export function updateDevice(data: Partial<Device>) {
  return defHttp.post({
    url: '/device/update',
    data,
  })
}

export function deleteDevice(id: string) {
  return defHttp.post({
    url: `/device/remove?id=${id}`,
  })
}