import { get, post } from "./http";

const prefix = 'devicesApi/charge/';

export default {
  //打开时校验用户是否在充电中
  checkIsCharging: (params) => {
    return get(prefix + 'checkUserChargeStatus', params);
  },
  //扫码之后校验 connector 是否可用接口
  checkQRStatus: (params) => {
    return get(prefix + 'checkChargeStatus', params);
  },
  //调用开始充电接口
  startCharge: (params) => {
    return get(prefix + 'startCharge', params);
  },
  //调用结束充电接口
  stopCharge: () => {
    return get(prefix+ 'endCharge', {});
  },
  //结算接口
  getChargeSummary: (params) => {
    return get(prefix + 'getChargeSummary', params);
  },
  getChargeSummaryV2: (params) => {
    return get(prefix + 'getReceipt', params);
  },
  //获取充电接口状态的接口
  getCurrentStatus: (params) => {
    return get(prefix + 'checkConnectorStatus', params);
  },
  //查询用户是否正在充电
  getUserCharging: () => {
    return get(prefix + 'getUserCharging', {});
  },
  //预定充电接口
  reserveCharge: (params) => {
    return post(prefix + 'chargeReserve', params)
  },
  //检查用户是否有生效的预定
  getUserReserve: (sitePk) => {
    return get(prefix + 'checkUserReserve', { sitePk: sitePk })
  },
  //取消预定
  cancelReserve: (reservePk) => {
    return get(prefix + 'cancelReserve', { reservePk: reservePk });
  },
  getConnectorDetail: (params) => {
    return get(prefix + 'getConnectorUsageDetail', params);
  }
}