(()=>{function e(n,t,e,a,i,r,o,l,c){var s=this,p="alarm.type.mapping",u=l("Alarm mappings automatically transform the description and severity based on alarm type matching. Alarm types are a defined property of each alarm created on the platform."),e=e.createEnum([{name:"NONE",label:l("Drop"),icon:"circle",class:"text-muted"},{name:"CRITICAL",label:l("Critical"),icon:v("critical"),class:"status critical"},{name:"MAJOR",label:l("Major"),icon:v("major"),class:"status major"},{name:"MINOR",label:l("Minor"),icon:v("minor"),class:"status minor"},{name:"WARNING",label:l("Warning"),icon:v("warning"),class:"status warning"}]);function m(e){n.options=e;e=t.when(e.length);e=e.then(function(e){return{title:l("Alarm mapping"),subtitle:!_.isUndefined(e)&&0<e?c.getPlural(e,"1 mapping","{{$count}} mappings",{qty:e}):""}}),o.changeTitle(e)}function g(e){var t=e.value.split("|");return e.severity=t.shift(),e.description=t.join("|"),delete e.value,e}function y(e){return{key:e.key,category:e.category,value:"".concat(e.severity,"|").concat(e.description||"")}}function d(e){return _.map(e,g)}function f(){n.options=[];var e={category:p};n.loading=!0,a.detail(e).then(h).then(d).then(m).finally(function(){n.loading=!1})}function h(e){return _.map(e.data,function(e,t){return{category:p,value:e,key:t}})}function v(e){return i.icon(e)||"circle"}function O(){n.newOption={category:p,severity:"WARNING"},s.newOption=n.newOption}n.severities=e,s.severities=e,n.icon=v,n.iconClass=function(e){return"NONE"===e?"text-muted":e},n.getOptionCopy=function(e){return _.cloneDeep(e)},n.refresh=f,n.add=O,n.save=function(e){var t="".concat(e.self?"update":"create","Option"),e=y(e);a[t](e).finally(function(){n.status.isOpen=!1,delete n.newOption,delete s.newOption}).then(f)},n.onClickDelete=function(e){var t=y(e);r({title:l("Delete alarm mapping"),body:c.getString('You are about to delete alarm mapping for alarm type "{{alarmType}}". Do you want to proceed?',{alarmType:e.key}),status:"danger",size:"sm",labels:{ok:l("Delete")}}).then(angular.bind(a,a.deleteOption,t)).then(f)},n.helpText=u,n.paging={refresh:!0},n.status={isOpen:!1},f(),n.$watch("status.isOpen",function(e){e&&O()})}e.$inject=["$scope","$q","c8yBase","c8ySettings","c8yAlarms","c8yModal","c8yTitle","gettext","gettextCatalog"],angular.module("c8y.parts.alarmMapping").controller("alarmMappingCtrl",e)})();