import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
import {MastodonApiModule} from "../../../mastodon-api/src/lib/mastodon-api.module";
import {
    NbActionsModule,
    NbContextMenuModule, NbDialogModule,
    NbGlobalPhysicalPosition,
    NbLayoutModule,
    NbMenuModule, NbProgressBarModule,
    NbThemeModule,
    NbToastrModule
} from "@nebular/theme";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {SharedModule} from './shared/shared.module';
import {NbEvaIconsModule} from "@nebular/eva-icons";
import {StoreModule} from '@ngrx/store';
import {StoreDevtoolsModule} from "@ngrx/store-devtools";
import {applicationStateReducers} from "./shared/state/store/reducers";
import {EffectsModule} from "@ngrx/effects";
import {ApplicationEffects} from "./shared/state/store/effects";
import {NgProgressModule} from "ngx-progressbar";
import {NgProgressHttpModule} from "ngx-progressbar/http";

const toastrConfig = {
    duration: 3000,
    position: NbGlobalPhysicalPosition.BOTTOM_RIGHT,
    preventDuplicates: true,
    destroyByClick: true,
};

@NgModule({
    bootstrap: [AppComponent],
    declarations: [
        AppComponent,
    ],
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        AppRoutingModule,
        MastodonApiModule.forRoot(),
        StoreModule.forRoot({}),
        StoreModule.forFeature('applicationState', applicationStateReducers),
        EffectsModule.forRoot(ApplicationEffects),
        StoreDevtoolsModule.instrument({
            maxAge: 25,
            logOnly: false,
            autoPause: true,
            features: {
                pause: false,
                lock: true,
                persist: true
            }
        }),
        SharedModule,
        NgProgressModule,
        NgProgressHttpModule,
        // Nebula
        NbContextMenuModule,
        NbMenuModule.forRoot(),
        NbDialogModule.forRoot(),
        NbEvaIconsModule,
        NbActionsModule,
        NbThemeModule.forRoot({name: 'dark'}),
        NbToastrModule.forRoot(toastrConfig),
        NbLayoutModule,
    ],
    providers: []
})
export class AppModule {
}
