import './vendor.ts';
import {NgModule, Injector, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {HTTP_INTERCEPTORS} from '@angular/common/http';
import {Ng2Webstorage, LocalStorageService, SessionStorageService} from 'ngx-webstorage';
import {JhiEventManager} from 'ng-jhipster';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http';
import {AuthInterceptor} from './blocks/interceptor/auth.interceptor';
import {AuthExpiredInterceptor} from './blocks/interceptor/auth-expired.interceptor';
import {ErrorHandlerInterceptor} from './blocks/interceptor/errorhandler.interceptor';
import {NotificationInterceptor} from './blocks/interceptor/notification.interceptor';
import {BootappSharedModule, UserRouteAccessService} from './shared';
import {PaginationConfig} from './blocks/config/uib-pagination.config';
import {FileUploadModule} from 'ng2-file-upload';
import {CommonModule, LocationStrategy, PathLocationStrategy} from '@angular/common';
import {LayoutService} from './layouts/layout.service';
import {NgxEchartsModule} from 'ngx-echarts';

import {
    FooterComponent,
    ProfileService,
    PageRibbonComponent,
    ErrorComponent
} from './layouts';
import {AppComponent} from './app.component';
import {RouterModule} from '@angular/router';
import {DEBUG_INFO_ENABLED} from './app.constants';
import {route} from './app.route';
import {LoginGuard} from './shared/common/loginGuard';
import {AppMainModule} from './app.main.module';
import {AppService} from './app.service';
import {NzMessageService, NzNotificationService} from 'ng-zorro-antd';

@NgModule({
    imports: [
        AppMainModule,
        BrowserModule,
        NgxEchartsModule,
        HttpModule,
        BrowserAnimationsModule,
        RouterModule,
        Ng2Webstorage.forRoot({prefix: 'smart', separator: '-'}),
        BootappSharedModule,
        FileUploadModule,
        CommonModule,
        FormsModule,
        ReactiveFormsModule,
        RouterModule.forRoot(route, {useHash: true})
    ],
    declarations: [
        ErrorComponent,
        PageRibbonComponent,
        FooterComponent,
        AppComponent,
    ],
    providers: [
        LayoutService,
        ProfileService,
        PaginationConfig,
        LoginGuard,
        AppService,
        UserRouteAccessService,
        {
            provide: HTTP_INTERCEPTORS,
            useClass: AuthInterceptor,
            multi: true,
            deps: [
                LocalStorageService,
                SessionStorageService,
                NzMessageService,
            ]
        },
        {
            provide: HTTP_INTERCEPTORS,
            useClass: AuthExpiredInterceptor,
            multi: true,
            deps: [
                Injector
            ]
        },
        {
            provide: HTTP_INTERCEPTORS,
            useClass: ErrorHandlerInterceptor,
            multi: true,
            deps: [
                JhiEventManager,
                NzMessageService,
                NzNotificationService,
            ]
        },
        {
            provide: HTTP_INTERCEPTORS,
            useClass: NotificationInterceptor,
            multi: true,
            deps: [
                Injector
            ]
        },
    ],
    bootstrap: [AppComponent],
    schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
    exports: []
})
export class BootappAppModule {
}
