import {
  NgModule,
  ModuleWithProviders,
  Type,
  Inject,
  InjectionToken,
} from '@angular/core';

import {
  _REST_BASE_URL,
} from './core';

import {
  SERVICES, RESTService,
} from './service';

export interface RESTFeatureModuleConfig {
  url?: any;
}

export interface RESTRootModuleConfig {
  baseURL: string;
}

@NgModule({})
export class RESTRootModule {
  constructor(
    private restService: RESTService,
  ) {
  }
}

@NgModule({})
export class RESTFeatureModule {
  constructor(
    private restService: RESTService,
    private root: RESTRootModule,
  ) {
  }
}

@NgModule({})
export class RESTModule {
  static forRoot(config: RESTRootModuleConfig): ModuleWithProviders {
    return {
      ngModule: RESTRootModule,
      providers: [
        {
          provide: _REST_BASE_URL,
          useValue: config.baseURL,
        },
        SERVICES,
      ],
    };
  }

  static forFeature(config: RESTFeatureModuleConfig): ModuleWithProviders {
    return {
      ngModule: RESTFeatureModule,
      providers: [
      ],
    };
  }
}
