(()=>{function e(a,l,o,e){var c="retention/retentions",t={headers:o.contentHeaders("retentionRule","retentionRule")},r={ALARM:["fragmentType"],EVENT:[],MEASUREMENT:[],OPERATION:["type"],BULK_OPERATION:["fragmentType","type","source"],AUDIT:["fragmentType"],"*":["fragmentType","type"]};return{list:function e(n){var t=o.url(c);n=o.pageSizeFilter(n);var r={params:n,silentError:!0};n=o.cleanListCallback("retentionRules",e,n);return a.get(t,r).then(n,l.reject)},detail:function(e){e=u(e);return e?a.get(e):l.reject("Retention rule object is not valid")},create:n,update:i,save:function(e){return(e.id?i:n)(e)},remove:function(e){e=u(e);return e?a.delete(e):l.reject("Retention rule object is not valid")},dataTypes:["ALARM","EVENT","MEASUREMENT","OPERATION","AUDIT","*"],DATA_TYPES:o.createEnum([{name:"ALARM",value:"ALARM",label:e("Alarm"),icon:"bell"},{name:"EVENT",value:"EVENT",label:e("Event"),icon:"online1"},{name:"MEASUREMENT",value:"MEASUREMENT",label:e("Measurement"),icon:"combo-chart"},{name:"OPERATION",value:"OPERATION",label:e("Operation"),icon:"c8y-energy"},{name:"BULK_OPERATION",value:"BULK_OPERATION",label:e("Bulk operation"),icon:"c8y-energy"},{name:"AUDIT",value:"AUDIT",label:e("Audit"),icon:"calendar-check-o"},{name:"*",value:"*",label:e("All"),icon:"asterisk"}]),isFieldSupportedByRule:function(e,n){return!_.includes(r[e.dataType||"*"]||[],n)}};function n(e){var n=o.url(c);return a.post(n,e,t)}function i(e){var n=u(e);return a.put(n,e,t)}function u(e){e=e&&e.id||e;return e?o.url("".concat(c,"/").concat(e)):""}}e.$inject=["$http","$q","c8yBase","gettext"],angular.module("c8y.core").factory("c8yRetentions",e)})();