import * as i0 from '@angular/core';
import { Injectable, NgModule } from '@angular/core';
import { hookRoute, ViewContext } from '@c8y/ngx-components';
import * as i1 from '@c8y/ngx-components/context-dashboard';
import { ContextDashboardType, ContextDashboardModule, ContextDashboardComponent } from '@c8y/ngx-components/context-dashboard';

class AssetDashboardGuard {
    constructor(contextDashboardService) {
        this.contextDashboardService = contextDashboardService;
    }
    canActivate(route) {
        return this.contextDashboardService.activateDashboards(route, [
            ContextDashboardType.Group,
            ContextDashboardType.Type
        ]);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AssetDashboardGuard, deps: [{ token: i1.ContextDashboardService }], target: i0.ɵɵFactoryTarget.Injectable }); }
    static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AssetDashboardGuard, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AssetDashboardGuard, decorators: [{
            type: Injectable,
            args: [{ providedIn: 'root' }]
        }], ctorParameters: () => [{ type: i1.ContextDashboardService }] });

class ViewAssetContextDashboardModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: ViewAssetContextDashboardModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.19", ngImport: i0, type: ViewAssetContextDashboardModule, imports: [ContextDashboardModule] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: ViewAssetContextDashboardModule, providers: [
            hookRoute([
                {
                    path: 'dashboard/:dashboardId',
                    component: ContextDashboardComponent,
                    canActivate: [AssetDashboardGuard],
                    canDeactivate: [(component) => component.canDeactivate()],
                    context: ViewContext.Group,
                    rootContext: ViewContext.Dashboard
                }
            ])
        ], imports: [ContextDashboardModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: ViewAssetContextDashboardModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [ContextDashboardModule],
                    providers: [
                        hookRoute([
                            {
                                path: 'dashboard/:dashboardId',
                                component: ContextDashboardComponent,
                                canActivate: [AssetDashboardGuard],
                                canDeactivate: [(component) => component.canDeactivate()],
                                context: ViewContext.Group,
                                rootContext: ViewContext.Dashboard
                            }
                        ])
                    ]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { ViewAssetContextDashboardModule };
//# sourceMappingURL=c8y-ngx-components-context-dashboard-asset-view.mjs.map
