import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
import { DataFetcher } from '../../DataFetcher';
export default function getPersonalizedReports(requestBody) {
  const application = ApplicationContext.getContextValue("__SNK__APPLICATION__");
  const serviceName = `${application.getModuleName()}@DataExporterSPBean.getPersonalizedReports`;
  const payload = { serviceName, requestBody };
  return new Promise((resolve, reject) => (DataFetcher.get()
    .callServiceBroker(serviceName, ObjectUtils.objectToString(payload))
    .then(result => resolve(getFormatResponse(result)))
    .catch(error => reject(error))));
}
function getFormatResponse(result) {
  var _a;
  const response = (_a = result === null || result === void 0 ? void 0 : result.json) === null || _a === void 0 ? void 0 : _a.$;
  if (response == undefined) {
    return;
  }
  return ObjectUtils.stringToObject(response);
}
