import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { CubeGridComponent } from 'ng2-spin-kit-new/app/spinner/cube-grid';
import { FormsModule } from '@angular/forms';
import { Http, HttpModule, JsonpModule, RequestOptions, XHRBackend } from '@angular/http';
import { NgbModule, NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { AuthenticationModule } from 'angular-my-login';

import { APP_CONFIG, AppConfig } from './app.config';
import { BANK_CONFIG, BankConfig } from './component/bank/bank.config';
import { MainModule } from './component/main/main.module';
import { PageHeaderModule } from './component/page-header/page-header.module';
import { routing } from './app.routes';
import { AppService } from './app.service';
import { AlertService, BudgetUserService, HttpService } from './service/index'; 
import { AuthenticationService } from 'angular-my-login'; 
import { AlertComponent } from './component/alert/alert.component';
import { AppComponent }  from './app.component';
import { BankComponent } from './component/bank/bank.component';
import { BankPlaidService } from './service/bank-plaid.service';
import { BankService } from './service/bank.service';
import { HomeComponent } from './component/home/home.component';
import { LoginComponent } from './component/login/login.component';
import { LoadingModalComponent } from './component/modal/loading-modal/loading-modal.component';
import { ProfileComponent } from './component/profile/profile.component';
import { RegistrationComponent } from './component/registration/registration.component';
import { AuthGuard } from './guard/auth.guard';

@NgModule({
  imports:      [ BrowserModule,
                  FormsModule,
                  HttpModule,
                  JsonpModule, 
                  PageHeaderModule,
                  MainModule,
                  NgbModule.forRoot(),
                  AuthenticationModule.forRoot(),
                  routing ],
  declarations: [ AlertComponent,
                  AppComponent,
                  BankComponent,
                  CubeGridComponent,
                  HomeComponent,
                  LoadingModalComponent,
                  LoginComponent,
                  ProfileComponent,
                  RegistrationComponent ],
  providers:    [ AuthGuard,
                  AlertService,
                  AppService,
                  AuthenticationService,
                  BankPlaidService,
                  BankService,
                  BudgetUserService,
                  { provide: APP_CONFIG, useValue: AppConfig },
                  { provide: BANK_CONFIG, useValue: BankConfig },
                  { provide: Http, useFactory: (backend: XHRBackend, options: RequestOptions, modalService: NgbModal) => {
                      return new HttpService(backend, options, modalService);
                  },
                    deps: [XHRBackend, RequestOptions, NgbModal]} ],
  bootstrap:    [ AppComponent ],
  entryComponents:
                [ LoadingModalComponent ]
})
export class 
 { }

AppModule