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


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

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

  /**
   * @Author Sum1Dream
   * @methodName getDiscountPackageList
   * @Description // 查询优惠券包列表
   * @Date 3:16 下午 2021/11/29
   * @Param [paramsObject , callBack]
   */
  public getDiscountPackageList(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  public getDiscountPackageRecordList(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageRecordList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName getDiscountById
   * @Description // 查询优惠券包详情
   * @Date 9:18 上午 2021/11/30
   * @Param [id: number, callBack]
   */
  public getDiscountPackageById(id: number, callBack) {
    this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageById?id=' + id).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * @Author Sum1Dream
   * @methodName insertCouponPackageInfo
   * @Description // 配置优惠券包基本信息
   * @Date 5:18 下午 2021/11/29
   * @Param [params: object, callBack]
   */
  public insertCouponPackageInfo(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/insertCouponPackageInfo', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName updateCouponPackageInfo
   * @Description // 修改优惠券包基本信息
   * @Date 10:08 上午 2021/11/30
   * @Param [params: object, callBack]
   */
  public updateCouponPackageInfo(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/updateCouponPackageInfo', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName insertCouponPackageRule
   * @Description // 新增优惠券包规则
   * @Date 10:11 上午 2021/11/30
   * @Param [params: object, callBack]
   */
  public insertCouponPackageRule(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/insertCouponPackageRule', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName deleteDiscountPackageRule
   * @Description // 删除优惠券
   * @Date 11:10 上午 2021/11/30
   * @Param [id: number , callBack]
   */
  public deleteDiscountPackageRule(id: number , callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/deleteDiscountPackageRule', {
      discountPackageId: id
    }).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName getDiscountPackageRuleById
   * @Description //查询优惠券包规则
   * @Date 10:12 上午 2021/11/30
   * @Param [id: number , callBack]
   */
  public getDiscountPackageRuleById(id: number, callBack) {
    this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageRuleById?id=' + id).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName upDiscountPackage
   * @Description // 上架优惠券包
   * @Date 11:50 上午 2021/11/30
   * @Param [param: object, callBack]
   */
  public upDiscountPackage(param: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/upDiscountPackage', param).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName downDiscountPackage
   * @Description // 下架优惠券包
   * @Date 11:51 上午 2021/11/30
   * @Param [param: object, callBack]
   */
  public downDiscountPackage(param: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/downDiscountPackage', param).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName deleteDiscountPackage
   * @Description // 删除优惠券包
   * @Date 11:53 上午 2021/11/30
   * @Param [param: object, callBack]
   */
  public deleteDiscountPackage(param: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/deleteDiscountPackage', param).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName addDiscountPackageStock
   * @Description // 新增库存
   * @Date 4:47 下午 2021/12/8
   * @Param [param: object, callBack]
   */
  public addDiscountPackageStock(param: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/addDiscountPackageStock', param).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * @Author Sum1Dream
   * @methodName getDiscountInventoryRecordServList
   * @Description // 查询补库记录
   * @Date 4:48 下午 2021/12/8
   * @Param [paramsObject: object, callBack]
   */
  public getDiscountInventoryRecordServList(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountInventoryRecordServList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName getDiscountPackageOrderList
   * @Description // 查询优惠券包订单列表
   * @Date 4:19 下午 2021/12/9
   * @Param [paramsObject: object, callBack]
   */
  public getDiscountPackageOrderList(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageOrderList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  public getPhoneListByFileUrl(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/getPhoneListByFileUrl', paramsObject).subscribe(data => {
      callBack(data);
    });
  }

  public getPhoneRegisterStatus(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/getPhoneRegisterStatus', paramsObject).subscribe(data => {
      callBack(data);
    });
  }

  public getHandleByPackageId(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/getHandleByPackageId', paramsObject).subscribe(data => {
      callBack(data);
    });
  }

  public giveAway(paramsObject: object, callBack) {
    this.http.post(environment.baseUrl + 'highDiscountPackage/giveAway', paramsObject).subscribe(data => {
      callBack(data);
    });
  }



}
