#ifndef _DaoCharge_H_
#define _DaoCharge_H_

#include "DataFields.h"

namespace DMChargerData
{
    const string TABLENAME = "charge_status";
    const string ID = "id";
    const string DEVICE_ID = "device_id";
    const string STATUS = "status";
    const string VOLTAGE = "voltage";
    const string CURRENT = "current";
    const string POWER = "power";
    const string PEAK = "peak";
    const string VALLEY = "valley";
    const string SHARP = "sharp";
    const string FLAT = "flat";
    const string SOC = "soc";
    const string CREATE_TIME = "create_time";
}

namespace DMChargeRecord
{
    const string TABLENAME = "charge_record";
    const string ID = "id";
    const string DEVICE_ID = "device_id";	// 设备ID
    const string BATTERY_CODE = "battery_code";
    const string START_TIME = "start_time";
    const string END_TIME = "end_time";
    const string DURATION = "duration";
    const string ELECTRICITY = "electricity";	// 本次充电电量
    const string TOP_ELECT = "top_elect";		// 尖阶段电量
    const string TOP_AMOUNT = "top_amount";		// 尖阶段电费
    const string PEAK_ELECT = "peak_elect";		// 峰阶段电量
    const string PEAK_AMOUNT = "peak_amount";	// 峰阶段电费
    const string FLAT_ELECT = "flat_elect";		// 平阶段电量
    const string FLAT_AMOUNT = "flat_amount";	// 平阶段电费
    const string VALLEY_ELECT = "valley_elect"; // 谷阶段电量
    const string VALLEY_AMOUNT = "valley_amount";	// 谷阶段电费
    const string PAY_AMOUNT = "pay_amount";		// 本次充电金额
    const string METER_VALUE_START = "meter_value_start";	// 电表总起值
    const string METER_VALUE_END = "meter_value_end";		// 电表总止值
    const string SOC_START = "soc_start";	// 充电前soc
    const string SOC_END = "soc_end";		// 充电后soc
    const string STATUS = "status";			// 状态
    const string CHARGE_STOP_CAUSE = "charge_stop_cause";	// 停止原因
}

namespace DMChargeDataRecord
{
    const string TABLENAME = "charge_data_record";
    const string DEVICE_ID = "device_id";
    const string DEVICE_CODE = "device_code";
    const string COLLECT_TIME = "collect_time";
    const string VOLTAGE = "voltage";
    const string CURRENT = "current";
    const string POWER = "power";
}

class DaoCharge
{
public:
    /**
    * 创建充电业务订单记录
    * @param: [std::string biz_id] 充电业务订单ID
    * @param: [std::string device_id] 充电业务的充电机设备ID
    */
    static bool create_charge_record(std::string biz_id, int device_id);

    /**
     * 更新充电业务订单记录
     * @param: [std::string biz_id] 充电业务订单ID
     * @param: [DataFields fields] 需要更新的字段
     */
    static bool update_charge_record(std::string biz_id, int device_id, DataFields fields);


    static void query_charger(vector<DataFields>& result);
    static void query_charger_attr(vector<DataFields>& result);



};

#endif // !_DaoCharge_H_
