

import request from '/@/utils/request';
import type { IDeviceListReponse } from './tyeps/index.type';
import type { AxiosPromise } from 'axios';
import type { ICommonListParams } from '../common.type';

export function Add(params: string) {
	return request({
		url: '/device/info/add',
		method: 'post',
		data: params,
	});
}
export function update(params: string) {
	return request({
		url: '/device/info/update',
		method: 'post',
		data: params,
	});
}
export function deleteId(params: string) {
	return request({
		url: '/device/info/delete',
		method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
		data: params,
	});
}

/**
 * 获取设备列表
 * @param params 
 * @returns 
 */
export function list(params: ICommonListParams) : AxiosPromise<IDeviceListReponse> {
    return request({
      url: '/device/info/list',
      method: 'post',
      params
    })
}
export function printPatientCardCode(data: object) {
	return request({
		url: '/device/info/printPatientCardCode',
		method: 'post',
		data,
	});
}
export function listRecords(params: object) {
    return request({
      url: '/device/clean/execute/listRecords',
      method: 'post',
      data:params
    })
}

export function getRecordsByDeviceCodeApi(params: object) {
    return request({
      url: '/device/clean/execute/getRecordsByDeviceCode',
      method: 'post',
      data:params
    })
} 

export function listAvailableDevices(params: object) {
    return request({
		url: '/hemo/med/schedule/template/listAvailableDevices',
		method: 'post',
		headers: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
		params,
    })
}

/**
 * 获取消毒过滤器名称api
 * @param clientCode 
 * @returns 
 */
export function listBacterialFilterApi(clientCode: string) {
    return request({
        url: '/device/clean/plan/listBacterialFilter',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        params: { clientCode },
    })
}
// 添加设备消毒记录
export function Addxd(params: object) {
    return request({
        url: '/device/clean/execute/add',
        method: 'post',
        data: params,
    })
}
// 修改设备消毒记录
export function updatexd(params: object) {
    return request({
        url: '/device/clean/execute/update',
        method: 'post',
        data: params,
    })
}
// 删除 设备消毒记录
export function deleteIdxd(params: string) {
    return request({
        url: '/device/clean/execute/delete',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        data: params,
    })
}
// 查询血压计日志
export function bpPushList(params: object) {
    return request({
      url: '/device/yu/yue/bp/push/list',
      method: 'post',
      params
    })
}

/**
 * 设定手动刷新副屏任务API:
 * @param deviceCode 
 * @returns 
 */
export function refreshSubScreenApi(deviceCode: string) {
        return request({
        url: '/device/info/setSubScreenRefreshJob',
        method: 'post',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        params: { deviceCode },
    })
}