// Angular Core
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

// Services
import { ApiService } from '../api/api.service';

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

  constructor(private http: HttpClient, public api: ApiService) { }

  /**
  * Get unaccepted products of users.
  * @returns {unresolved}
  */
  searchUnaccepted() {
    return this.api.read('/User-ReshopUnaccepted');
  };

  /**
   * Update Reshop Auctions
   * @param {json} data
   * @returns {object} promise
  */
  saveReshopAuctions(unacceptedId: number, shoppedId: number) {
    var data = {
      'unacceptedId': unacceptedId,
      'shoppedId': shoppedId
    };
    return this.api.create('/User-ReshopUnaccepted', data);
  };

  /**
   * Call back error method
   * @param {json} response
   */
  errorCallBack(response: any) {
    this.api.errorCallback(response);
  };

}
