import { DemoDataServiceConfig , DemoDataService } from "./demo-data.service" ; import { ClassProvider , FactoryProvider , ModuleWithProviders , NgModule , ValueProvider , } from "@angular/core" ; import { DemoDataGeneratingProgressDialogComponent } from "./demo-data-generating-progress-dialog.component" ; import { MatProgressBarModule } from "@angular/material/progress-bar" ; import { MatDialogModule } from "@angular/material/dialog" ; /**
 * Generate realist mock entities for testing and demo purposes.
 *
 * Import this module in the root AppModule to automatically write demo data into the database on loading of the module.
 * You need to pass providers for  DemoDataGenerator implementations to the `forRoot()` method to register them.
 *
  ```
  DemoDataModule.forRoot([
     ...DemoChildGenerator.provider({count: 150}),
     { provide: DemoUserGeneratorService, useClass: DemoUserGeneratorService }
  ])
  ```
 *
 * In addition to importing the `DemoDataModule` you need to call the  DemoDataService 's `publishDemoData()` method
 * to actually start the data generation.
 * Use `DemoDataGeneratingProgressDialogComponent.loadDemoDataWithLoadingDialog(this.dialog);` passing a `MatDialog` service
 * to display a dialog box to the user and automatically handle the data generation.
 *
 * To implement your own demo data generator, refer to the How-To Guides:
 * - [How to Generate Demo Data] {@link /additional-documentation/how-to-guides/generate-demo-data.html} @ NgModule ( { imports : [ MatProgressBarModule , MatDialogModule ] , declarations : [ DemoDataGeneratingProgressDialogComponent ] , exports : [ DemoDataGeneratingProgressDialogComponent ] , } ) export class DemoDataModule { param demoDataGeneratorProviders static forRoot ( demoDataGeneratorProviders ) { return { ngModule : DemoDataModule , providers : [ DemoDataService , { provide : DemoDataServiceConfig , useValue : { dataGeneratorProviders : demoDataGeneratorProviders } , } , demoDataGeneratorProviders , ] , } ; } }