import {ErrorHandler, 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 {WebbpmComponent} from "./component/webbpm.component";
import {WebbpmRoutingModule} from "./webbpm-routing.module";
import {NgbModule} from "@ng-bootstrap/ng-bootstrap";
import {ToastNoAnimationModule} from "ngx-toastr";
import {AppModule} from "../app/app.module";
import {HomeComponent} from "./component/home.component";
import {
  BpmnModule,
  ComponentsModule,
  CoreModule,
} from "@webbpm/base-package";
import {AppRoutingModule} from "../app/app-routing.module";
import {GlobalErrorHandler} from "./handler/global-error.handler.prod";
import {DEFAULT_HTTP_INTERCEPTOR_PROVIDERS} from "./interceptor/default-interceptors.prod";
import {HttpClientModule, HttpClientXsrfModule} from "@angular/common/http";
import {TokenConstants} from "../security/TokenConstants";

let IMPORTS = [
  BrowserAnimationsModule,
  BrowserModule,
  FormsModule,
  NgbModule,
  ToastNoAnimationModule.forRoot(),
  AgGridModule,
  AppRoutingModule,
  BpmnModule,
  CoreModule,
  ComponentsModule,
  AppModule,
  WebbpmRoutingModule,
  HttpClientModule,
  HttpClientXsrfModule.withOptions(
      {cookieName: TokenConstants.CSRF_TOKEN_NAME, headerName: TokenConstants.CSRF_HEADER_NAME})
];

@NgModule({
            imports: IMPORTS,
            declarations: [
              WebbpmComponent,
              HomeComponent
            ],
            exports: [],
            providers: [
              {provide: ErrorHandler, useClass: GlobalErrorHandler},
              DEFAULT_HTTP_INTERCEPTOR_PROVIDERS
            ],
            bootstrap: [
              WebbpmComponent
            ]
          })
export class WebbpmModule {
}
