import { NgModule, ModuleWithProviders } from '@angular/core';
import { ProvidersComponent } from './providers.component';
import { ENVIRONMENTER } from './_environment/environment.token';
import { HttpClientModule } from '@angular/common/http';
import { AmountDirective } from './_directives/amount.directive';
import { DecimalPipe } from '@angular/common';
import { RateDirective } from './_directives/rate.directive';
import { FormatDirective } from './_directives/format.directive';
import { CurrencyDirective } from './_directives/currency.directive';
import { NumberOnlyDirective } from './_directives/numberOnly.directive';

@NgModule({
  declarations: [ProvidersComponent, AmountDirective, RateDirective, FormatDirective, CurrencyDirective
    ,NumberOnlyDirective],
  imports: [
    HttpClientModule,
  ],
  exports: [ProvidersComponent, AmountDirective, RateDirective, FormatDirective, CurrencyDirective
    ,NumberOnlyDirective],
  providers: [DecimalPipe]
})
export class ProvidersModule {

  static forRoot(config: any): ModuleWithProviders<ProvidersModule> {
    return {
      ngModule: ProvidersModule,
      providers: [
        { provide: ENVIRONMENTER, useValue: config }
      ]
    };
  }

}
