import { Injectable } from '@angular/core';
import {CommonsService} from "./commons.service";
import {environment} from "../../environments/environment";
import {HttpClient} from '@angular/common/http';

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

  constructor(
      private http: HttpClient,
      private common: CommonsService
  ) { }

  /**
   * 编辑价格
   * @param paramObject 参数
   * @param callBack
   */
  editPrice(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'tyAgentPrice/editPrice', paramObject).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 批量配置价格
   * @param paramObject 参数
   * @param callBack
   */
  batchConfigPrice(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'tyAgentPrice/batchConfigPrice', paramObject).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 批量配置油品
   * @param paramObject 参数
   * @param callBack
   */
  batchConfigOilNo(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'tyAgentPrice/batchConfigOilNo', paramObject).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 油站价格
   * @param paramObject 参数
   * @param callBack
   */
  getOilStationPrice(belongType: number, oilStationId: number, callBack) {
    this.http.get(environment.baseUrl + 'tyAgentPrice/getOilStationPrice?belongType=' + belongType + '&oilStationId=' + oilStationId).subscribe(data => {
      callBack(data);
    });
  }

}
