/* tslint:disable */
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */

import {
  NgModule,
  ModuleWithProviders,
  SkipSelf,
  Optional,
} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ApiConfiguration, ApiConfigurationParams } from './api-configuration';

import { StruttureApiClient } from './services/strutture-api-client';
import { AuthApiClient } from './services/auth-api-client';
import { AccountsApiClient } from './services/accounts-api-client';
import { StipulatoriApiClient } from './services/stipulatori-api-client';
import { RolesApiClient } from './services/roles-api-client';
import { NomenclatoreApiClient } from './services/nomenclatore-api-client';
import { LuoghiApiClient } from './services/luoghi-api-client';
import { StrutturePubblicheApiClient } from './services/strutture-pubbliche-api-client';

/**
 * Module that provides all services and configuration.
 */
@NgModule({
  imports: [],
  exports: [],
  declarations: [],
  providers: [
    StruttureApiClient,
    AuthApiClient,
    AccountsApiClient,
    StipulatoriApiClient,
    RolesApiClient,
    NomenclatoreApiClient,
    LuoghiApiClient,
    StrutturePubblicheApiClient,
    ApiConfiguration,
  ],
})
export class ApiModule {
  static forRoot(
    params: ApiConfigurationParams,
  ): ModuleWithProviders<ApiModule> {
    return {
      ngModule: ApiModule,
      providers: [
        {
          provide: ApiConfiguration,
          useValue: params,
        },
      ],
    };
  }

  constructor(
    @Optional() @SkipSelf() parentModule: ApiModule,
    @Optional() http: HttpClient,
  ) {
    if (parentModule) {
      throw new Error(
        'ApiModule is already loaded. Import in your base AppModule only.',
      );
    }
    if (!http) {
      throw new Error(
        'You need to import the HttpClientModule in your AppModule! \n' +
          'See also https://github.com/angular/angular/issues/20575',
      );
    }
  }
}
