angular.module("c8y.cockpit.export").factory("c8yExportFilters",["$q","c8yBase","c8yInventory","c8yGroups",function(e,o,a,t){function r(e,t){this.name=e,this.onLoad(t)}function n(e,t){r.call(this,e,t)}function i(e,t,o){r.call(this,e,t,o)}return r.prototype.onLoad=function(e){this.value=e.queryParameters[this.name],this.enabled=Boolean(e.queryParameters[this.name])},r.prototype.onSave=function(e){this.enabled&&(e.queryParameters[this.name]=this.value)},(n.prototype=Object.create(r.prototype)).onLoad=function(e){e=e.queryParameters;this.value=e.source||e.groupId,this.enabled=Boolean(this.value),this.loadSource()},n.prototype.loadSource=function(){var t=this;return this.value?a.detail(this.value).then(o.getResData).then(function(e){t.value=e}):e.when()},n.prototype.onSave=function(e){e=e.queryParameters;delete e.source,delete e.groupId,this.enabled&&this.value&&(t.isGroup(this.value)?e.groupId=this.value.id:e.source=this.value.id)},(i.prototype=Object.create(r.prototype)).onLoad=function(e){var t=e.queryParameters;this.value={dateType:t.dateType||"LAST_7DAYS",from:t.from,to:t.to},this.enabled=void 0!==t.dateType||""===e.name},i.prototype.onSave=function(e){e=e.queryParameters;delete e.dateType,delete e.from,delete e.to,this.enabled&&_.merge(e,this.value)},{Filter:r,SourceFilter:n,DateRangeFilter:i}}]);