import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { DiceDto, DiceResult } from './dice.model';
import { environment } from '@environments/environment';

@Injectable({
  providedIn: 'root',
})
export class DiceService {
  private apiUrl = `${environment.apiUrl}/dice`;

  private http = inject(HttpClient);

  rollDice(diceDto: DiceDto): Observable<DiceResult> {
    return this.http.post<DiceResult>(this.apiUrl, diceDto);
  }
}
