"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.presetsBaseBundle = exports.presetsSnippet = void 0;

var _toGqlQuery = require("../utils/to-gql-query");

const oralSedativesSnippet = "oralSedatives{id name unit dose route}";
const parenDrugsSnippet = "parenDrugs{id name unit draw dose route}";
const infusionDrugsSnippet = "infusionDrugs{id name dose unit bolusUnit}";
const base = ['enabled', oralSedativesSnippet];
const presetsSnippet = (0, _toGqlQuery.toGqlQuery)(['dischargeScoreType', 'calculateDrugWaste', 'vtIgnored', 'vtSelected', ['local', 'enabled', 'localDrugs{id dose epi name unit percent}'], ['minimal', ...base], ['moderate', ...base, parenDrugsSnippet, infusionDrugsSnippet], ['deep', ...base, parenDrugsSnippet, infusionDrugsSnippet], ['ga', ...base, parenDrugsSnippet, infusionDrugsSnippet]]);
exports.presetsSnippet = presetsSnippet;
const presetsBaseBundle = {
  name: 'presets',
  doFetchPresetsForMemberRaw: (orgId, memberId) => ({
    gqlFetch
  }) => gqlFetch("{providerPresets(orgId:\"".concat(orgId, "\",memberId:\"").concat(memberId, "\")").concat(presetsSnippet, "}")).then(res => res.data.providerPresets),
  // deprecated, can delete once price tiers are shipped
  doFetchPresetsForCompositionRaw: (orgId, compositionId) => ({
    gqlFetch
  }) => gqlFetch("{providerPresetsForComposition(orgId:\"".concat(orgId, "\",compositionId:\"").concat(compositionId, "\")").concat(presetsSnippet, "}")).then(res => res.data.providerPresetsForComposition),
  doFetchPresetsAndLimitForComposition: (orgId, compositionId) => ({
    gqlFetch
  }) => gqlFetch('{' + "providerPresetsForComposition(orgId:\"".concat(orgId, "\",compositionId:\"").concat(compositionId, "\")").concat(presetsSnippet) + "org(orgId: \"".concat(orgId, "\") {subscription {sedationLevelLimit}}") + '}').then(res => ({
    presets: res.data.providerPresetsForComposition,
    sedationLevelLimit: res.data.org.subscription.sedationLevelLimit
  }))
};
exports.presetsBaseBundle = presetsBaseBundle;