import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { StorageModule } from '@ngx-pwa/local-storage';
import { BulmaNavbarModule } from '@angular-bulma/components';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { AuthenticationModule } from './authentication/authentication.module';
import { FlashMessageModule } from './flash-message/flash-message.module';
import { GraphqlModule } from './graphql/graphql.module';
import { HomeModule } from './home/home.module';
import { HttpErrorInterceptor } from './http-error.interceptor';
import { JwtInterceptor } from './jwt.interceptor';
import { NotFoundComponent } from './not-found/not-found.component';
import { UserService } from './user/user.service';

@NgModule({
  imports: [
    // Third-party modules
    BrowserModule.withServerTransition({ appId: 'serverApp' }),
    StorageModule.forRoot({
      // eslint-disable-next-line @typescript-eslint/naming-convention
      IDBDBName: 'agineek'
    }),
    ReactiveFormsModule,
    HttpClientModule,
    BulmaNavbarModule,
    // Application Modules
    AppRoutingModule,
    GraphqlModule,
    FlashMessageModule,
    HomeModule,
    AuthenticationModule
  ],
  declarations: [AppComponent, NotFoundComponent],
  providers: [
    UserService,
    // {
    //   provide: HTTP_INTERCEPTORS,
    //   useClass: HttpErrorInterceptor
    // },
    {
      provide: HTTP_INTERCEPTORS,
      useClass: JwtInterceptor,
      multi: true
    }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
