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 ConfigService {
  constructor(
      private http: HttpClient,
      private common: CommonsService
  ) { }

  /**
   * 查询列表
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public getListGoodsType(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'highGoodsType/getListGoodsType?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * @Author Sum1Dream
   * @methodName insertGoodsType
   * @Description // 新增
   * @Date 10:25 上午 2021/11/19
   * @Param [params , callBack]
   */
  public insertGoodsType(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highGoodsType/insertGoodsType', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 修改卡券
   *
   * @param params 上传对象
   * @param  callBack   回调
   * @return data 返回结果
   */
  public updateGoodsType(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highGoodsType/updateGoodsType', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 根据id查询详情
   *
   * @param  id   公司id
   * @param  callBack   回调
   */
  public getGoodsTypeById(id: number, callBack) {
    this.http.get(environment.baseUrl + 'highGoodsType/getGoodsTypeById?id=' + id).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * 删除
   *
   * @param params  status
   * @param callBack 返回参数
   */
  public getGoodsTypeByDelete(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highGoodsType/getGoodsTypeByDelete' , params).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * 查询列表
   *
   * @param  paramsObject   对象
   * @param  callBack   回调
   */
  public getBrandByList(paramsObject: object, callBack) {
    this.http.get(environment.baseUrl + 'highBrand/getBrandByList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 新增
   *
   * @param params 上传对象
   * @param  callBack   回调
   * @return data 返回结果
   */
  public insertBrand(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highBrand/insertBrand', params).subscribe(data => {
        callBack(data);
    });
  }

  /**
   * 修改卡券
   *
   * @param params 上传对象
   * @param  callBack   回调
   * @return data 返回结果
   */
  public updateBrand(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highBrand/updateBrand', params).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 根据id查询详情
   *
   * @param  id   公司id
   * @param  callBack   回调
   */
  public findById(id: number, callBack) {
    this.http.get(environment.baseUrl + 'highBrand/findById?id=' + id).subscribe(data => {
      callBack(data);
    });
  }


  /**
   * 删除
   *
   * @param params  status
   * @param callBack 返回参数
   */
  public getByDelete(params: object, callBack) {
    this.http.post(environment.baseUrl + 'highBrand/getByDelete' , params).subscribe(data => {
      callBack(data);
    });
  }

}
