import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ENUMS_API_ROUTES } from './constants/apiRoutes';
import { TEnumApi } from './models';
import { IApiEnumResponse } from './models/io';

@Injectable({ providedIn: 'root' })
export class EnumsService {
  constructor(private http: HttpClient) {}

  private apiRoutes = ENUMS_API_ROUTES;

  getAll(type: TEnumApi): Observable<IApiEnumResponse[]> {
    return this.http.get<IApiEnumResponse[]>(this.apiRoutes[type]);
  }
}
