import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { CalculatePriceColor } from '../models/calculate-price-color.model';
import { ColorsTintometrico } from '../models/colors-tintometrico.model';

@Injectable({
  providedIn: 'root'
})
export class TintometricoService {

constructor(
  private httpClient: HttpClient
) { }


getColors(letter: string, product: string): Observable<ColorsTintometrico[]> {
  const response = this.httpClient.get<ColorsTintometrico[]>(`${environment.url}tintometrico/colors?letter=${letter}&product=${product}`);
  return response;
}

calculatePrice(productColor: CalculatePriceColor) {
  console.log('Calculando preco tintometrico....(service)');
  const response = this.httpClient.post<CalculatePriceColor>(`${environment.url}tintometrico/calculatePrice`, productColor);
  return response;
}

}
