// **********************************************
// Angular Core
// **********************************************
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule } from '@angular/router';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';

// **********************************************
// External dependencies
// **********************************************
import { MDBBootstrapModule } from 'angular-bootstrap-md';

// **********************************************
// App Components
// **********************************************
import { AppComponent } from './app.component';
import { HeaderComponent } from './header/header.component';
import { ServerComponent } from './server/server.component';
import { LoginComponent } from './login/login.component';
import { DisconnectionComponent } from './disconnection/disconnection.component';

// **********************************************
// App Services
// **********************************************
import { ServerService } from './server/server.service';
import { LoginService } from './login/login.service';
import { AuthService } from './core/services/auth.service';

// Router
import { appRoutes } from './app.routes';

// Interceptor
import { TokenInterceptor } from './core/interceptors/token-interceptor';

@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    ServerComponent,
    LoginComponent,
    DisconnectionComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    FormsModule,
    RouterModule.forRoot(
      appRoutes,
      // { enableTracing: true } // Enabling tracing
      { onSameUrlNavigation: 'reload' }
    ),
    MDBBootstrapModule.forRoot()
  ],
  providers: [
    ServerService,
    LoginService,
    AuthService,
    {
      provide: HTTP_INTERCEPTORS,
      useClass: TokenInterceptor,
      multi: true
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }
