import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {
  BehaviorSubject,
  filter,
  map,
  Observable,
  of,
  switchMap,
  take,
  tap,
  throwError,
} from 'rxjs';

@Injectable({
  providedIn: 'root',
})
export class IndexingService {
  // Private
  private __indexingSetting = new BehaviorSubject<any | undefined>(undefined);

  /**
   * Constructor
   */
  constructor(private _httpClient: HttpClient) {}

  // -----------------------------------------------------------------------------------------------------
  // @ Accessors
  // -----------------------------------------------------------------------------------------------------

  /**
   * Getter for game
   */
  get indexingSetting$(): Observable<any | undefined> {
    return this.__indexingSetting.asObservable();
  }

  // -----------------------------------------------------------------------------------------------------
  // @ Public methods
  // -----------------------------------------------------------------------------------------------------

  /**
   * Get powerballs
   *
   *
   */
  getIndexingSetting(): Observable<void> {
    return this._httpClient.get<void>('api/apps/settings/indexing').pipe(
      tap((response) => {
        // this.__gameSetting.next(response.gameSetting);
      })
    );
  }
}
