// 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 AddProductService {

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

  /**
   * Gets Supplier Main Settings
   * @returns {object} promise
  */
  getCategoriesList() {
    return this.api.read('/Supplier-AddProduct/categoriesList');
  };

  searchNdc(data: any) {
    return this.api.read('/Supplier-AddProduct/getNDCInfo?ndc=' + data);
  };

  addSingleProduct(data: any) {
    return this.api.create("/Supplier-AddProduct", data);
  };

  /**
   * Call back error method for manage supplier service
   */
  errorCallBack(response: any) {
    this.api.errorCallback(response);
  };
}
