import { ModuleWithProviders, NgModule } from '@angular/core';
import { ModuleConfig } from './config/module-config';
import { _MODULE_CONFIG } from './config/token';

import { SERVICES } from './services';

@NgModule({})
export class WebStorageRootModule {}

@NgModule({})
export class WebStorageModule {
  public static forRoot(
    config: ModuleConfig
  ): ModuleWithProviders<WebStorageRootModule> {
    return {
      ngModule: WebStorageRootModule,
      providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES],
    };
  }
}
