import createAxios from '@/utils/request'
// 新增出厂设备
export const addEquipmentDelivery = (data: any) => {
    return createAxios({
        url: '/cs-device-boot/EquipmentDelivery/addEquipmentDelivery',
        method: 'POST',
        data: data
    })
}

// 删除出厂设备
export const deleteEquipmentDelivery = (id: any) => {
    let form = new FormData()
    form.append('id', id)
    return createAxios({
        url: '/cs-device-boot/EquipmentDelivery/AuditEquipmentDelivery',
        method: 'POST',
        data: form
    })
}

// 恢复出厂设置
export const resetEquipmentDelivery = (id: any) => {
    let form = new FormData()
    form.append('nDid', id)
    return createAxios({
        url: '/access-boot/device/resetFactory',
        method: 'POST',
        data: form
    })
}

// 编辑出厂设备
export const editEquipmentDelivery = (data: any) => {
    return createAxios({
        url: '/cs-device-boot/EquipmentDelivery/updateEquipmentDelivery',
        method: 'POST',
        data
    })
}

// 上传拓扑图
export const uploadTopo = (file: any) => {
    let form = new FormData()
    form.append('file', file)
    return createAxios({
        url: '/cs-device-boot/topologyTemplate/uploadImage',
        method: 'POST',
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        data: form
    })
}
// 批量导入设备
export const batchImportDevice = (file: any) => {
    let form = new FormData()
    form.append('file', file)
    return createAxios({
        url: '/cs-device-boot/EquipmentDelivery/importEquipment',
        method: 'POST',
        responseType: 'blob',
        data: form
    })
}

// 直连设备注册接入
export const governDeviceRegister = (data: any) => {
    return createAxios({
        url: `/access-boot/device/register?nDid=${data.nDid}&type=${data.type}`,
        method: 'POST'
    })
}

// 便携式设备注册
export const portableDeviceRegister = (params: any) => {
    return createAxios({
        url: `/access-boot/device/wlRegister`,
        method: 'POST',
        params
    })
}

// 便携式设备接入
export const portableDeviceAccess = (data: any) => {
    return createAxios({
        url: `/access-boot/device/wlAccess?nDid=${data.nDid}`,
        method: 'POST'
    })
}
// 下载模版
export function getExcelTemplate() {
    return createAxios({
        url: '/cs-device-boot/EquipmentDelivery/getExcelTemplate',
        method: 'get',
        responseType: 'blob'
    })
}
// 查询工程信息列表
export function engineeringProject() {
    return createAxios({
        url: '/cs-device-boot/engineeringProjectRelation/list',
        method: 'post'
    })
}
//监测设备接入
export function onlineRegister(data: any) {
    return createAxios({
        url: '/access-boot/device/onlineRegister',
        method: 'post',
        params: data
    })
}
//重启设备
export function resetFactory(data: any) {
    return createAxios({
        url: '/access-boot/device/resetFactory',
        method: 'post',
        params: data
    })
}
//修改mac后接入
export function accessByUpdateMac(data: any) {
    return createAxios({
        url: '/access-boot/device/accessByUpdateMac',
        method: 'post',
        params: data
    })
}
