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,
  LocalStorageService,
  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 {VBoxLoadValues} from "../../account_applications/component/container/VBoxLoadValues";
import {ErvuAccountTextFieldGridEditor} from "../../account_applications/component/editablegrid/editors/ErvuAccountTextFieldGridEditor";
import {TokenInterceptor} from "./interceptor/token.interceptor.service";
import {DropdownTreeViewComponent}from "../../account_applications/component/field/DropdownTreeViewComponent";
import {DropdownTreeviewSelectComponent} from "../../account_applications/component/external/ngx-treeview/dropdown-treeview-select/dropdown-treeview-select.component";
import {TreeviewModule} from "ngx-treeview";
import {ErvuStaticGrid} from "../../account_applications/component/grid/ErvuStaticGrid";
import {AuthorizationService} from "./service/authorization.service";
import {UserScopeLocalStorageService} from "./service/user-scope-local-storage.service";

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

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