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

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

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

/* ----------------------------活动金 - 参与用户配置--------------------------------- */
  
   /**
 *   获取未参与的商户列表
 * @param paramObject 参数 
 * @param callBack
 */
    queryNotPartMerList(paramObject: object, callBack) {
      this.http.get(environment.baseUrl + 'rebatePartMer/queryNotPartMerList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
        callBack(data);
      });
    }


  
  /**
 * 添加参与活动用户
 * @param paramObject 参数
 * @param callBack
 */
   addPartMer(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'rebatePartMer/addPartMer', paramObject).subscribe(data => {
      callBack(data);
    });
  }

   /**
 * 禁用
 * @param paramObject 参数
 * @param callBack
 */
    disable(paramObject: object, callBack) {
      this.http.post(environment.baseUrl + 'rebatePartMer/disable', paramObject).subscribe(data => {
        callBack(data);
      });
    }
    
   /**
 * 启用
 * @param paramObject 参数
 * @param callBack
 */
    enable(paramObject: object, callBack) {
      this.http.post(environment.baseUrl + 'rebatePartMer/enable', paramObject).subscribe(data => {
        callBack(data);
      });
    }

     /**
 *    获取参与的商户列表
 * @param paramObject 参数 
 * @param callBack
 */
      queryPartMerList(paramObject: object, callBack) {
        this.http.get(environment.baseUrl + 'rebatePartMer/queryPartMerList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
          callBack(data);
        });
      }

      /* ----------------------------活动金 - 奖池业务--------------------------------- */
      
     /**
 *    获取奖池列表
 * @param paramObject 参数 
 * @param callBack
 */
      queryRewardList(paramObject: object, callBack) {
        this.http.get(environment.baseUrl + 'rebateReward/queryRewardList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
          callBack(data);
        });
      }

       /**
 *   获取奖池详情、奖池名单
 * @param paramObject 参数 
 * @param callBack
 */
        queryRewardDetail(paramObject: object, callBack) {
          this.http.get(environment.baseUrl + 'rebateReward/queryRewardDetail?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
            callBack(data);
          });
        }

           /**
 * 发放奖池金额
 * @param paramObject 参数
 * @param callBack
 */
      grantReward(paramObject: object, callBack) {
      this.http.post(environment.baseUrl + 'rebateReward/grantReward', paramObject).subscribe(data => {
        callBack(data);
      });
    }

     /**
 *   导出奖池商户名单
 * @param paramObject 参数 
 * @param callBack
 */
      exportRewardRoster(paramObject: object, callBack) {
        this.http.get(environment.baseUrl + 'rebateReward/exportRewardRoster?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
          callBack(data);
        });
      }

}
