import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ReactiveFormsModule } from '@angular/forms';

import { FlexLayoutModule } from '@angular/flex-layout';

import { ScrollingModule } from '@angular/cdk/scrolling';

import { MatRippleModule } from '@angular/material';

import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select';
import { MatTreeModule } from '@angular/material/tree';

import { PerfectScrollbarModule } from 'ngx-perfect-scrollbar';
import { VirtualScrollerModule } from 'ngx-virtual-scroller';

import { TranslateModule } from '@ngx-translate/core';
import { UCapUiModule } from '@ucap-webmessenger/ui';

import { TenantSearchComponent } from './components/tenant-search.component';
import { TreeComponent } from './components/tree.component';
import { OrganizationService } from './services/organization.service';

const COMPONENTS = [TenantSearchComponent, TreeComponent];
const SERVICES = [OrganizationService];
const DIRECTIVES = [];

@NgModule({
  imports: [
    CommonModule,
    ReactiveFormsModule,

    FlexLayoutModule,
    ScrollingModule,

    MatRippleModule,
    MatButtonModule,
    MatIconModule,
    MatInputModule,
    MatSelectModule,
    MatTreeModule,

    TranslateModule,

    PerfectScrollbarModule,
    VirtualScrollerModule,

    UCapUiModule
  ],
  exports: [...COMPONENTS, ...DIRECTIVES],
  declarations: [...COMPONENTS, ...DIRECTIVES]
})
export class UCapUiOrganizationModule {
  public static forRoot(): ModuleWithProviders<UCapUiOrganizationModule> {
    return {
      ngModule: UCapUiOrganizationModule,
      providers: [...SERVICES]
    };
  }
}
