import { DeviceAccModel, DeviceAccQueryParam } from '@/types'
import request from '@/until/request'

/**
 * 获取设备台账列表
 * @param data DeviceAccQueryParam
 */
const QueryDeviceAccList = (data: DeviceAccQueryParam) =>
    request({
        url: '/DeviceAccAction/list',
        method: 'post',
        data: data
    })

/**
* 新增设备台账
* @param data DeviceAccModel
*/
const AddDeviceAcc = (data: DeviceAccModel) =>
    request({
        url: '/DeviceAccAction/saveDeviceAcc',
        method: 'post',
        data: data
    })

/**
* 编辑设备台账
* @param data DeviceAccModel
*/
const EditDeviceAcc = (data: DeviceAccModel) =>
    request({
        url: '/DeviceAccAction/updateDeviceAcc',
        method: 'post',
        data: data
    })

/**
* 删除设备台账
* @param  id number
*/
const DeleteDeviceAcc = (id: number) =>
    request({
        url: '/DeviceAccAction/deleteDeviceAcc/' + id,
        method: 'get',
    })

/**
 * 根据SN查询台账
 * @param deviceSn 
 * @returns 
 */
const FindDeviceAccBysn = (deviceSn: string) =>
    request({
        url: '/DeviceAccAction/findDeviceAccBysn/' + deviceSn,
        method: 'get',
    })

export default {
    QueryDeviceAccList,
    AddDeviceAcc,
    EditDeviceAcc,
    DeleteDeviceAcc,
    FindDeviceAccBysn
}