/* tslint:disable */
import { NgModule, ModuleWithProviders } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { CrmConfiguration, CrmConfigurationInterface } from './crm-configuration';

import { CustomerService } from './services/customer.service';
import { OptInService } from './services/opt-in.service';
import { PayerService } from './services/payer.service';

/**
 * Provider for all Crm services, plus CrmConfiguration
 */
@NgModule({
  imports: [
    HttpClientModule
  ],
  exports: [
    HttpClientModule
  ],
  declarations: [],
  providers: [
    CrmConfiguration,
    CustomerService,
    OptInService,
    PayerService
  ],
})
export class CrmModule {
  static forRoot(customParams: CrmConfigurationInterface): ModuleWithProviders<CrmModule> {
    return {
      ngModule: CrmModule,
      providers: [
        {
          provide: CrmConfiguration,
          useValue: {rootUrl: customParams.rootUrl}
        }
      ]
    }
  }
}
