import {APP_INITIALIZER, ErrorHandler, forwardRef, NgModule} from "@angular/core";
import {BrowserModule} from "@angular/platform-browser";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {FormsModule} from "@angular/forms";
import {AgGridModule} from "ag-grid-angular";
import {NgbModule} from "@ng-bootstrap/ng-bootstrap";
import {ToastNoAnimationModule} from "ngx-toastr";
import {AppModule} from "../app/app.module";
import {
  AppConfigService,
  AppVersionService,
  BpmnModule,
  ComponentsModule,
  CoreModule, ProgressIndicationService,
} from "@webbpm/base-package";
import {AppRoutingModule} from "../app/app-routing.module";
import {GlobalErrorHandler} from "../webbpm/handler/global-error.handler.prod";
import {DEFAULT_HTTP_INTERCEPTOR_PROVIDERS} from "./interceptor/mfe-default-interceptors.prod";
import {MfeAppVersionService} from "./service/mfe-app-version.service";
import {MfeAppConfigService} from "./service/mfe-app-config.service";
import {MfeWebbpmComponent} from "./component/mfe-webbpm.component";
import {MfeWebbpmRoutingModule} from "./mfe-webbpm-routing.module";
import {MfeWrapperComponent} from "./component/mfe-wrapper.component";
import {MfeProgressIndicationService} from "./service/mfe-progress-indication.service";
import {RolesGuard} from "../app/guard/RolesGuard";
import {MfeRolesGuard} from "./guard/MfeRolesGuard";
import {TokenProvider} from "../app/provider/token.provider";
import {MfeTokenProvider} from "./provider/mfe-token.provider";
import {AccessDeniedComponent} from "../app/component/access-denied.component";

let IMPORTS = [
  BrowserAnimationsModule,
  BrowserModule,
  FormsModule,
  NgbModule,
  ToastNoAnimationModule.forRoot(),
  AgGridModule,
  AppRoutingModule,
  BpmnModule,
  CoreModule,
  ComponentsModule,
  AppModule,
  MfeWebbpmRoutingModule
];

@NgModule({
            imports: IMPORTS,
            declarations: [
              MfeWrapperComponent,
              MfeWebbpmComponent,
              AccessDeniedComponent
            ],
            exports: [],
            providers: [
              {provide: AppVersionService, useClass: MfeAppVersionService},
              {provide: AppConfigService, useClass: MfeAppConfigService},
              {provide: ErrorHandler, useClass: GlobalErrorHandler},
              {provide: ProgressIndicationService, useClass: MfeProgressIndicationService},
              {provide: RolesGuard, useClass: MfeRolesGuard},
              {provide: TokenProvider, useClass: MfeTokenProvider},
              DEFAULT_HTTP_INTERCEPTOR_PROVIDERS
            ],
            bootstrap: [
              MfeWrapperComponent
            ]
          })
export class MfeWebbpmModule {
}
