import {NgModule, NgZone} from "@angular/core";
import {FormsModule} from "@angular/forms";
import {BrowserModule} from "@angular/platform-browser";
import {AgGridModule} from "ag-grid-angular";
import {PreviewComponent} from "./component/preview.component";
import {PreviewRoutingModule} from "./preview-routing.module";
import {PreviewContainerComponent} from "./component/preview-container.component";
import {NgbModule} from "@ng-bootstrap/ng-bootstrap";
import {ToastNoAnimationModule} from "ngx-toastr";
import {AppModule} from "../app/app.module";
import {ComponentsModule, CoreModule, SecurityModule} from "@webbpm/base-package";
import {TaskParamsProvider} from "@webbpm/base-package";
import {HTTP_INTERCEPTORS} from "@angular/common/http";
import {HttpPreviewInterceptor} from "./service/http-preview-interceptor.service";

export const HTTP_INTERCEPTOR_PROVIDERS = [
  { provide: HTTP_INTERCEPTORS, useClass: HttpPreviewInterceptor, multi: true }
];

let IMPORTS = [
  BrowserModule,
  FormsModule,
  NgbModule,
  ToastNoAnimationModule.forRoot(),
  AgGridModule,
  CoreModule,
  ComponentsModule,
  AppModule,
  SecurityModule,
  PreviewRoutingModule
];

@NgModule({
  imports: IMPORTS,
  declarations: [
    PreviewContainerComponent,
    PreviewComponent
  ],
  exports: [],
  providers: [
    TaskParamsProvider,
    HTTP_INTERCEPTOR_PROVIDERS
  ],
  bootstrap: [
    PreviewContainerComponent
  ]
})
export class PreviewModule {

  constructor(zone: NgZone) {
    window['zoneImpl'] = zone;
  }
}
