"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 r=require("../../../constants/assetTypes.js");function s(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("../../../constants/corvaCompanyId.js"),require("../../GradientManager/configuration/constants.js");var n=s(e);exports.formatAsset=function(e){var s=e.asset,n=e.group,a=void 0===n?null:n,i=e.activeWellId,l=void 0===i?null:i,o=e.isRequiredAssetId,u=e.isPrimaryAsset,c=e.isDrillingPlatformApp;if(!s)return null;var d,p,S,v={id:+s.assetId||+s.id,type:s.type,name:s.name};(o&&(v.id=+s.id,v.assetId=+s.assetId),a&&(v.group=a),s.type===r.ASSET_TYPES.rig.type)&&(v.activeWellId=Number(null===(d=s.activeWell)||void 0===d?void 0:d.id)||null,c&&(v.activeWellId=Number(null===(p=s.activeWell)||void 0===p?void 0:p.assetId)||null));"interventionUnit"===s.type&&(v.activeWellId=Number(null===(S=s.activeWell)||void 0===S?void 0:S.id)||null);return s.type!==r.ASSET_TYPES.well.type&&s.type!==t.DEFAULT_ASSET_TYPE||(v.status=Number(s.id)===l?t.ACTIVE_STATUS:null),s.type===r.ASSET_TYPES.pad.type&&(v.parentFracFleetId=s.parentFracFleetId,v.status=s.active&&s.current?t.ACTIVE_STATUS:null,u&&!s.parentFracFleetId&&(v.status=null)),v},exports.getPrimaryAssetFields=function(e,t,s){var a=n.default(t);return e!==r.ASSET_TYPES.rig.type&&e!==r.ASSET_TYPES.intervention_unit.type||a.push("".concat(e,".active_well")),s?[].concat(n.default(a),["rig.active_child"]):a},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(n.default(t))}},exports.getSearchPlaceholder=function(e){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],s=r?t.ASSET_TYPE_SEARCH_PLACEHOLDERS:t.ASSET_TYPE_SEARCH_PLACEHOLDERS_NO_SECONDARY;return s[e]||"Search..."},exports.sortAsset=function(e){return e.status===t.ACTIVE_STATUS?-1:1};
//# sourceMappingURL=index.js.map
