import { NgModule, APP_INITIALIZER } from '@angular/core';
import { HTTP_INTERCEPTORS } from '@angular/common/http';

import { CookieService } from 'ngx-cookie-service';

import { BasicAuthHtppInterceptorService } from './interceptor/basic-auth.http-interceptor';
import {
  API_BASE_URL,
  GRAFANA_API_TOKEN,
  GRAFANA_API_BASE_URL
} from 'src/modules/common/type/injection-token.type';

@NgModule({
  imports: [],
  exports: [],
  providers: [
    CookieService,
    {
      provide: HTTP_INTERCEPTORS,
      useClass: BasicAuthHtppInterceptorService,
      multi: true
    },
    {
      provide: API_BASE_URL,
      useValue: 'http://localhost:8088/api',
      multi: true
    },
    {
      provide: GRAFANA_API_BASE_URL,
      useValue: 'http://localhost:3000/api',
      multi: true
    },
    {
      provide: GRAFANA_API_TOKEN,
      useValue:
        'eyJrIjoiNmQxU2pSSHNlU1AzNHc3aHZheWNYdWltd1lRM1ZvNnYiLCJuIjoiQVBNX0FQSSIsImlkIjoxfQ==',
      multi: true
    }
  ]
})
export class AppProviderModule {}
