import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { HttpClientModule,HttpClient } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule, TranslateLoader} from '@ngx-translate/core';
import {TranslateHttpLoader} from '@ngx-translate/http-loader';


/* CUSTOM-MODULES */

import {makerModule} from './maker/maker.module';
import {ForexModule} from './forex/forex.module';
import {DeliveryModule} from './delivery/delivery.module';
import {StartModule} from './start/start.module';
import {checkerModule} from './checker/checker.module';

/* Custom Services */

import { AuthService } from './providers/auth.service';
import { AuthGuard } from './providers/auth.guard';
import { WebService } from './providers/web.service';


export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}



@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    makerModule,
    ForexModule,
    DeliveryModule,
    ReactiveFormsModule,
    FormsModule,
    HttpClientModule,
    StartModule,
    checkerModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient]
      }
    })
  ],
  providers: [AuthGuard, AuthService, WebService],
  bootstrap: [AppComponent]
})
export class AppModule { }
