(()=>{e.$inject=["gettext","c8yDeviceProtocolUiProvider","c8yViewsProvider"];var o="c8yLwm2m";function e(h,e,t){a.$inject=["c8yBase","c8yInventory","c8yTenant","c8yObjectMappings","$http","$upload"],i.$inject=["$routeParams"];var n={service:o,id:"lwm2m",name:h("LWM2M")},p={path:"/deviceprotocols/".concat(n.id,"/:id"),template:'<c8y-lwm2m-detail id="vm.id"></c8y-lwm2m-detail>',controllerAs:"vm",controller:i};return{initUi:function(){e.register(n),t.when(p.path,p)},$get:a};function i(e){_.assign(this,e)}function a(t,n,e,i,a,o){var r,c=t.url("service/lwm2m-agent/"),s="".concat(c,"objectResourceMappings");return{flow:function(){return["c8yLwm2mUploadStep","c8yLwm2mFinalStep"]},list:function(){return a.get(s,{silentError:!0}).then(t.getResData)},detailPath:function(e){e=l(e);return p.path.replace(/:id$/,e)},upload:function(e){return o.upload({url:"".concat(s,"/ddf"),method:"POST",headers:{Accept:"application/json"},file:e,fileName:e.name.replace(/\s+/g,"_")})},remove:function(e){e=l(e);return n.remove(e)},getName:function(e){var t=i.getName(e),e=i.getObjectId(e);return"".concat(e," ").concat(t)},updateMapping:function(e,t){e="".concat(s,"/").concat(e,"/add");return a.put(e,t)},getPostRegistrationOptions:function(){var e={url:"".concat(c,"postRegistrationOptions"),method:"GET",silentError:!0};return a(e).then(t.getResData)},setPostRegistrationOptions:function(e){e={url:"".concat(c,"postRegistrationOptions"),method:"PUT",data:{commands:e}};return a(e)},helpTexts:{minPeriod:h("The minimum period attribute indicates the minimum time in seconds the LWM2M client MUST wait between two notifications."),maxPeriod:h("The maximum period attribute indicates the maximum time in seconds the LWM2M client MAY wait between two notifications."),greaterThan:h("This greater than attribute defines a threshold high value."),lessThan:h("This less than attribute defines a threshold low value."),step:h("This step attribute defines a minimum change value between two notifications.")},isServiceSubscribed:u,showIf:m,listRowInfoComponent:"c8yDeviceProtocolRowCountResources",getCustomActions:function(){r=r||a.get("".concat(c,"mappingActions/resourceactions")).then(t.getResData).then(d);return r},Validation:{RuleType:{LT:"lt",GT:"gt",EQ:"eq",NEQ:"neq",GTE:"gte",LTE:"lte",AND:"and",OR:"or"},ValueType:{NUMBER:"number",DATE:"date",STRING:"string",REGEX:"regex",OBJECTLINK:"objectLink"},ResourceDataType:{INTEGER:"INTEGER",FLOAT:"FLOAT",STRING:"STRING",BOOLEAN:"BOOLEAN",TIME:"TIME",OBJECTLINK:"OBJECTLINK"},RuleName:{GT:"Greater than",LT:"Lower than",GTE:"Greater or equals than",LTE:"Lower or equals than",EQ:"Equals",NEQ:"Equals not"}}};function u(){return e.isSubscribed({name:"lwm2m-agent",type:"MICROSERVICE"})}function m(){return m._cached=m._cached?m._cached:u()}function l(e){return _.get(e,"id")}function d(e){return _.reduce(e,function(e,t){var n=t.name,t=t.args,t=_.get(t,"length")?t.map(function(e){return"".concat(n,":").concat(e)}):[n];return e.concat(t)},[])}}}angular.module("c8y.lwm2m").provider(o,e)})();