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

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

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

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

export { DeviceDashboardGuard, ViewDeviceContextDashboardModule };
//# sourceMappingURL=c8y-ngx-components-context-dashboard-device-view.mjs.map
