import { defHttp } from '@/utils/http/axios';
import { ID, IDS, commonExport } from '@/api/base';
import {
  ElevatorRelevancyDeviceVO,
  ElevatorRelevancyDeviceForm,
  ElevatorRelevancyDeviceQuery,
} from './model';

/**
 * 查询电梯设备关联;列表
 * @param params
 * @returns
 */
export function elevatorRelevancyDeviceList(params?: ElevatorRelevancyDeviceQuery) {
  return defHttp.get<ElevatorRelevancyDeviceVO[]>({
    url: '/elevator/elevatorRelevancyDevice/list',
    params,
  });
}

/**
 * 导出电梯设备关联;列表
 * @param params
 * @returns
 */
export function elevatorRelevancyDeviceExport(params?: ElevatorRelevancyDeviceQuery) {
  return commonExport('/elevator/elevatorRelevancyDevice/export', params ?? {});
}

/**
 * 导出电梯设备关联;列表
 * @param params
 * @returns
 */
export function elevatorRunDataExport(params) {
  return commonExport('/elevator/behaviorStatistics/export', params ?? {});
}

/**
 * 导出电梯设备关联;列表
 * @param params
 * @returns
 */
export function elevatorBadDeviceExport(params) {
  return commonExport('/elevator/faultStatistics/export', params ?? {});
}

/**
 * 导出电梯设备关联;列表
 * @param params
 * @returns
 */
export function elevatorMaintenanceDeviceExport(params) {
  return commonExport('/elevator/faultStatistics/export', params ?? {});
}
/**
 * 查询电梯设备关联;详细
 * @param id id
 * @returns
 */
export function elevatorRelevancyDeviceInfo(id: ID) {
  return defHttp.get<ElevatorRelevancyDeviceVO>({ url: '/elevator/elevatorRelevancyDevice/' + id });
}

/**
 * 新增电梯设备关联;
 * @param data
 * @returns
 */
export function elevatorRelevancyDeviceAdd(data: ElevatorRelevancyDeviceForm) {
  return defHttp.postWithMsg<void>({ url: '/elevator/elevatorRelevancyDevice', data });
}

/**
 * 更新电梯设备关联;
 * @param data
 * @returns
 */
export function elevatorRelevancyDeviceUpdate(data: ElevatorRelevancyDeviceForm) {
  return defHttp.putWithMsg<void>({ url: '/elevator/elevatorRelevancyDevice', data });
}
/**
 * 关联设备;
 * @param data
 * @returns
 */
export function elevatorRelevancyDevice(data) {
  return defHttp.putWithMsg<void>({ url: '/elevator/elevatorRelevancyDevice/relevancy', data });
}
/**
 * 删除电梯设备关联;
 * @param id id
 * @returns
 */
export function elevatorRelevancyDeviceRemove(id: ID | IDS) {
  return defHttp.deleteWithMsg<void>({ url: '/elevator/elevatorRelevancyDevice/' + id });
}
