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 StoreDeviceService {

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

  /**
   * 查询门店设备列表
   * @param paramObject 参数
   * @param callBack
   */
  getStoreDeviceList(paramObject: object, callBack) {
    this.http.get(environment.baseUrl + 'storeDevice/getStoreDeviceList?' + this.commonsService.getWhereCondition(paramObject)).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 删除门店设备
   * @param paramObject 参数
   * @param callBack
   */
  delStoreDevice(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'storeDevice/delStoreDevice', paramObject).subscribe(data => {
      callBack(data);
    });
  }

  /**
   * 配置门店设备
   * @param storeId 门店id
   * @param callBack
   */
  configStoreDevice(paramObject: object, callBack) {
    this.http.post(environment.baseUrl + 'storeDevice/configStoreDevice', paramObject).subscribe(data => {
      callBack(data);
    });
  }
}
