import { stringify } from 'qs';
import { request } from 'umi';

export async function downloadPatrolQRCodeFile(params) {
  return request(`/device/item-path`, {
    method: 'POST',
    data: params,
  });
}
export async function getDeviceInfoByPath(params) {
  return request(`/device/item-path`, {
    method: 'POST',
    data: params,
  });
}
export async function getModelAttributes(params) {
  return request(
    `/device-info/${params.projectId}/${params.deviceCode}?${stringify(
      params,
    )}`,
  );
}
export async function getDeviceDataItemDictImpl(params) {
  return request(`/config/device-realtime-data/list/${params.projectId}`);
}
export async function getRealtimeData(params) {
  return request(`/jinke-cloud/device/current-data`, {
    method: 'POST',
    data: params,
  });
}
export async function getFolderTransfer(params) {
  return request(`/file-service/${params.projectId}/folders/transfer`);
}

export async function DeviceRecentChart(params) {
  return request(
    `/device-info-chart/${params.projectId}/${params.deviceCode}?${stringify(
      params,
    )}`,
  );
}
export async function getVarValues(params) {
  return request(`/api/v1/scada/get-var-values`, {
    method: 'POST',
    data: params,
    headers: { ContentType: 'application/x-www-form-urlencoded' },
  });
}
