(()=>{e.$inject=["c8yDeviceProtocolUiProvider","gettext"];var c="c8yOPCUADeviceV2";function e(e,t){r.$inject=["c8yBase","c8yInventory","c8yTenant","$location","$http"];var n={service:c,id:"opcuaV2",name:t("OPC UA")},u={path:"/deviceprotocols/".concat(n.id,"/:id")};return{initUi:function(){e.register(n)},$get:r};function r(n,e,t,r,c){var o=n.url("service/opcua-mgmt-service/"),i="".concat(o,"deviceTypes");return{showIf:a,isServiceSubscribed:a,flow:_.constant(["c8yOpcuaV2CreateStep"]),detailPath:function(e){e=n.getId(e);return u.path.replace(/:id$/,e)},create:function(e){var t=_.pick(e,["name","description"]);e.server&&(t.referencedServerId=e.server.id,t.referenceServerName=e.server.name);e.selectedNode&&(t.referencedRootNodeId=e.selectedNode.nodeId);return c.post(i,t).then(n.getResData).then(function(e){r.path("/deviceprotocols/opcuaV2/".concat(e.id))})},remove:function(e){e="".concat(i,"/").concat(e.id);return c.delete(e)},list:function(){return c.get(i,{silentError:!0}).then(n.getResData)},getName:function(e){return _.get(e,"name")},listServers:function(){return e.list({fragmentType:"c8y_ua_ClientConfig"}).then(n.getResData)},listRowInfoComponent:"c8yOpcuaV2RowInfo"};function a(){return t.isSubscribed("opcua-mgmt-service")}}}angular.module("c8y.opcua-v2").provider(c,e)})();