"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/toConsumableArray");require("lodash");var t=require("../constants.js");require("../../../constants/goals.js"),require("../../../constants/segment.js"),require("../../../constants/alerts.js"),require("../../../constants/apps.js"),require("../../../constants/drillstring.js"),require("../../../constants/completion.js"),require("../../../constants/appPackages.js"),require("../../../constants/notifications.js"),require("../../../constants/feed.js"),require("../../../constants/bha.js");var s=require("../../../constants/assetTypes.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../utils/env.js"),require("../../GradientManager/configuration/constants.js");var a=r(e);exports.formatAsset=function(e){var r=e.asset,a=e.group,n=void 0===a?null:a,i=e.activeWellId,u=void 0===i?null:i,l=e.isRequiredAssetId,o=e.isPrimaryAsset,c=e.isDrillingPlatformApp;if(!r)return null;var d,p,v={id:+r.assetId||+r.id,type:r.type,name:r.name};(l&&(v.id=+r.id,v.assetId=+r.assetId),n&&(v.group=n),r.type===s.ASSET_TYPES.rig.type)&&(v.activeWellId=Number(null===(d=r.activeWell)||void 0===d?void 0:d.id)||null,c&&(v.activeWellId=Number(null===(p=r.activeWell)||void 0===p?void 0:p.assetId)||null));return r.type!==s.ASSET_TYPES.well.type&&r.type!==t.DEFAULT_ASSET_TYPE||(v.status=Number(r.id)===u?t.ACTIVE_STATUS:null),r.type===s.ASSET_TYPES.pad.type&&(v.parentFracFleetId=r.parentFracFleetId,v.status=r.active&&r.current?t.ACTIVE_STATUS:null,o&&!r.parentFracFleetId&&(v.status=null)),v},exports.getPrimaryAssetFields=function(e,t,r){var n=e===s.ASSET_TYPES.rig.type?[].concat(a.default(t),["rig.active_well"]):t;return r?[].concat(a.default(n),["rig.active_child"]):n},exports.getRequestOptions=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{sort:"name",order:"asc",fields:["".concat(e,".name"),"".concat(e,".status")].concat(a.default(t))}},exports.sortAsset=function(e){return e.status===t.ACTIVE_STATUS?-1:1};
