import {base_api, base_api_v2, get, post} from './http.js'

export default {
  /**
   * 查询输入的连接器信息
   * @param {Object} data {chargeBoxId,connectorId}
   * @return Promise
   */
  getChargerDetails(data) {
    return get({
      url: base_api + "charging/charger-details",
      data: data
    })
  },
  /**
   * 获取充电桩连接器信息和状态
   * @param {Object} data {connectorPk,creditHistoryPk}
   * @return Promise
   */
  getChargingDetails(data) {
    return get({
      url: base_api + "charging/on-going",
      data: data
    })
  },
  checkChargingDetails(data) {
    return get({
      url: base_api + "charging/back-on-going",
      data: data
    })
  },
  /**
   * 创建支付订单
   * @param {Object} data {connectorPk}
   */
  makePayment(data) {
    return post({
      url: base_api + "charging/make-payment",
      data: data
    })
  },
  /**
   * 开始充电
   * @param {Object} data {connectorPk}
   */
  startCharge(data) {
    return post({
      url: base_api + "charging/start",
      data: data
    })
  },
  /**
   * 停止充电
   * @param {Object} data {connectorPk}
   */
  stopCharge(data) {
    return post({
      url: base_api + "charging/stop",
      data: data
    })
  },
  /**
   * 获取发票信息
   * @param {Object} chargingPk
   */
  getReceipt(chargingPk) {
    return get({
      url: base_api + "charging/receipts/" + chargingPk,
      data: {}
    })
  }
}