import { Injectable, Inject } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';

import { Observable } from 'rxjs';
import { User } from '../model/user.model';
import { API_BASE_URL } from 'src/modules/common/type/injection-token.type';
import { Page } from 'src/modules/common/data/model/page';

@Injectable({
  providedIn: 'root'
})
export class UserService {
  constructor(
    @Inject(API_BASE_URL) private apiBaseUrl: string,
    private httpClient: HttpClient
  ) {}

  public getUsers(): Observable<Page<User>> {
    return this.httpClient.get<Page<User>>(`${this.apiBaseUrl}/users`, {});
  }
}
