import { ApplicationConfig, importProvidersFrom } from '@angular/core';
import { provideRouter, withHashLocation, withRouterConfig } from '@angular/router';
import { routes } from './app.routes';
import { provideHttpClient } from '@angular/common/http';
import { BrowserModule } from '@angular/platform-browser';
import { DpModule } from 'dp-ui/dp.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { Angularlib } from 'angularlib/angularlib.module';
import { provideStore } from '@ngxs/store';
import { withNgxsReduxDevtoolsPlugin } from '@ngxs/devtools-plugin';
import { withNgxsStoragePlugin } from '@ngxs/storage-plugin';
import { provideServiceWorker} from '@angular/service-worker';
import { LoginModule } from 'angularlib/login';

export const appConfig: ApplicationConfig = {
  providers: [
    importProvidersFrom(BrowserModule),
    importProvidersFrom(BrowserAnimationsModule),
    provideStore([],withNgxsStoragePlugin({keys:'*'}),withNgxsReduxDevtoolsPlugin()),
    importProvidersFrom(DpModule),
    importProvidersFrom(Angularlib),
    importProvidersFrom(LoginModule),
    provideRouter(routes,withHashLocation(),withRouterConfig({onSameUrlNavigation:'reload'})),
    provideHttpClient(), 
    provideServiceWorker('ngsw-worker.js', {
      enabled: true,
      registrationStrategy: 'registerImmediately'
      // registrationStrategy: 'registerWhenStable:30000'
    })
  ]
};
