import { Injectable, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from '../../../../environments/environment';

import { LotInfo } from '../model/lotInfo.interface';
import { SaleInfo } from '../model/saleInfo.interface';

@Injectable({
    providedIn: 'root'
})
export class apiFavoriteService {
    ServeurURL = environment.ServeurURL;
    ApiURL = this.ServeurURL+"/api";

    constructor(private http: HttpClient){}    

    //Favorites
    saveFavorite(lotInfo: LotInfo, saleInfo: SaleInfo, picture: String, dateTime: string, buyProject: boolean, maxPrice: number, Note: string): Observable<any> {
        return this.http.post(this.ApiURL+'/favorite/save', {lotInfo, saleInfo, picture, dateTime, buyProject, maxPrice, Note});
    }

    getAllFavorite(): Observable<any> {
        return this.http.get(this.ApiURL+'/favorite/getAll');
    }
}
