"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/asyncToGenerator"),r=require("@babel/runtime/regenerator"),n=require("jsona"),i=require("../../../../../clients/jsonApi/index.js");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(e),s=a(t),c=a(r);function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?o(Object(r),!0).forEach((function(t){l.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var d=new(a(n).default),p={rig:i.getRigs,frac_fleet:i.getFracFleets,drillout_unit:i.getDrilloutUnits,pad:i.getPads,well:i.getWells,intervention_unit:i.getInterventionUnits},_={rig:["rig.name","rig.asset_id","rig.type","rig.active_well"],frac_fleet:["frac_fleet.name","frac_fleet.type","frac_fleet.current_pad_id","frac_fleet.pad_frac_fleets"],drillout_unit:["drillout_unit.name","drillout_unit.type"],well:["well.name","well.asset_id","well.type","well.rig_id","well.last_active_at","well.status"],pad:["pad.name","pad.asset_id","pad.type","pad.current_frac_fleet_id","pad.parent_frac_fleet_id","pad.active","pad.current"],intervention_unit:["intervention_unit.name","intervention_unit.type","intervention_unit.active_well"]},f={rig:{sort:"last_active_at",order:"desc"},frac_fleet:{sort:"last_active_at",order:"desc"},drillout_unit:{sort:"last_active_at",order:"desc"},well:{sort:"last_active_at",order:"desc"},pad:{sort:"last_active_at",order:"desc"},intervention_unit:{sort:"created_at",order:"desc"}},g={intervention_unit:"intervention_unit_id",rig:"rig",frac_fleet:"frac_fleet"},v=function(){var e=s.default(c.default.mark((function e(t){var r,n,i,a,s,o,v,b,y,w,O;return c.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.assetType,n=t.parentId,i=t.searchString,a=void 0===i?"":i,s=t.page,o=t.perPage,v=t.ids,b=t.parentType,y=t.additionalParams,w=p[r],e.next=4,w(u(u(u({per_page:o,fields:_[r],page:s},r in f?f[r]:{}),n&&b&&!a.trim()?l.default({},g[b],Number(n)):{search:a}),{},{ids:v},y));case 4:return O=e.sent,e.abrupt("return",d.deserialize(O));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();exports.loadAssets=v;
//# sourceMappingURL=loadAssets.js.map
