import {forwardRef, NgModule} from "@angular/core";
import {NgbModule} from "@ng-bootstrap/ng-bootstrap";
import {CommonModule, registerLocaleData} from "@angular/common";
import localeRu from '@angular/common/locales/ru';
import {FormsModule} from "@angular/forms";
import {AgGridModule} from "ag-grid-angular";
import {
  BpmnModule,
  ComponentsModule,
  CoreModule,
  ProgressIndicationService,
  SecurityModule
} from "@webbpm/base-package";
import {AppHeaderComponent} from "./component/app-header.component";
import {AppFooterComponent} from "./component/app-footer.component";
import {ApplicationVersionComponent} from "./component/application-version.component";
import {RouterModule} from "@angular/router";
import {InternationalPhoneNumberModule} from "ngx-international-phone-number";
import {AppProgressIndicationComponent} from "./component/app-progress-indication.component";
import {AppProgressIndicationService} from "./service/app-progress-indication.service";
import {ErvuChartV2} from "../../ervu_business_metrics/component/chart/ErvuChartV2";
import {FilterContainer} from "../../ervu_business_metrics/component/filter/FilterContainer";
import {TokenInterceptor} from "./interceptor/token-interceptor.service";
import {DropdownTreeViewComponent} from "../../component/field/DropdownTreeViewComponent";
import {DropdownTreeviewSelectComponent} from "../../component/external/ngx-treeview/dropdown-treeview-select/dropdown-treeview-select.component";
import {TreeviewModule} from "ngx-treeview";

registerLocaleData(localeRu);
export const DIRECTIVES = [
  forwardRef(() => AppHeaderComponent),
  forwardRef(() => AppFooterComponent),
  forwardRef(() => ApplicationVersionComponent),
  forwardRef(() => AppProgressIndicationComponent),
  forwardRef(() => ErvuChartV2),
  forwardRef(() => FilterContainer),
  forwardRef(() => DropdownTreeViewComponent),
  forwardRef(() => DropdownTreeviewSelectComponent)
];

@NgModule({
            imports: [
              CommonModule,
              FormsModule,
              CoreModule,
              NgbModule,
              BpmnModule,
              SecurityModule,
              ComponentsModule,
              AgGridModule,
              RouterModule,
              InternationalPhoneNumberModule,
              TreeviewModule.forRoot()
            ],
            declarations: [
              DIRECTIVES
            ],
            exports: [
              DIRECTIVES
            ],
            providers: [
              TokenInterceptor,
              {provide: ProgressIndicationService, useClass: AppProgressIndicationService}
            ],
            bootstrap: [],
            entryComponents: [AppProgressIndicationComponent]
          })
export class AppModule {
}
