package com.jsowell.pile.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jsowell.common.annotation.Excel;
import com.jsowell.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 订单对象 order_basic_info
 *
 * @author jsowell
 * @date 2022-09-30
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class OrderBasicInfo extends BaseEntity {
	private static final long serialVersionUID = 1L;

	/**
	 * 主键
	 */
	private Long id;

	/**
	 * 订单编号
	 */
	@Excel(name = "订单编号")
	private String orderCode;

	/**
	 * 交易流水号
	 */
	private String transactionCode;

	/**
	 * 订单状态(0-待支付；1-充电中；2-待结算；3-待补缴；4-异常；5-可疑；6-订单完成)
	 */
	@Excel(name = "订单状态")
	private String orderStatus;

	/**
	 * 会员id
	 */
	@Excel(name = "会员id")
	private String memberId;

	/**
	 * 站点id
	 */
	@Excel(name = "站点id")
	private String stationId;

	/**
	 * 充电桩sn号
	 */
	@Excel(name = "充电桩sn号")
	private String pileSn;

	/**
	 * 充电桩枪口号
	 */
	@Excel(name = "充电桩枪口号")
	private String connectorCode;

	/**
	 * 充电桩枪口编号
	 */
	@Excel(name = "充电桩枪口编号")
	private String pileConnectorCode;

	/**
	 * 逻辑卡号
	 */
	@Excel(name = "逻辑卡号")
	private String logicCard;

	/**
	 * 车辆vin码
	 */
	@Excel(name = "车辆vin码")
	private String vinCode;

	/**
	 * 启动方式
	 * 0-后管启动；1-用户app启动
	 */
	@Excel(name = "启动方式")
	private String startMode;

	/**
	 * 支付方式
	 * 1-余额支付；3-白名单支付; 4-微信支付；5-支付宝支付；
	 */
	@Excel(name = "支付方式")
	private String payMode;

	/**
	 * 支付状态
	 * 0-待支付；1-支付完成
	 */
	@Excel(name = "支付状态")
	private String payStatus;

	/**
	 * 支付金额
	 * 指用户本次需要充电的金额
	 */
	@Excel(name = "支付金额")
	private BigDecimal payAmount;

	/**
	 * 支付时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd")
	@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd")
	private Date payTime;

	/**
	 * 订单总金额 = 电费总金额 + 服务费总金额
	 */
	@Excel(name = "订单总金额")
	private BigDecimal orderAmount;

	/**
	 * 虚拟金额
	 */
	@Excel(name = "虚拟金额")
	private BigDecimal virtualAmount;

	/**
	 * 结算金额
	 */
	@Excel(name = "结算金额")
	private BigDecimal settleAmount;

	/**
	 * 充电开始时间
	 */
	private Date chargeStartTime;

	/**
	 * 充电结束时间
	 */
	private Date chargeEndTime;

	/**
	 * 启动类型
	 */
	private String startType;

	/**
	 * 预约时间
	 */
	private Date appointmentTime;

	/**
	 * 开始SOC
	 */
	private String startSOC;

	/**
	 * 结束SOC
	 */
	private String endSOC;

	/**
	 * 异常原因
	 */
	private String reason;

	/**
	 * 结算时间
	 */
	private Date settlementTime;

	/**
	 * 退款金额
	 */
	private BigDecimal refundAmount;

	/**
	 * 删除标识（0-正常；1-删除）
	 */
	private String delFlag;

	private List<OrderDetail> orderDetailList;

	@Override
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
				.append("id", id)
				.append("orderCode", orderCode)
				.append("orderStatus", orderStatus)
				.append("memberId", memberId)
				.append("stationId", stationId)
				.append("pileSn", pileSn)
				.append("connectorCode", connectorCode)
				.append("startMode", startMode)
				.append("payMode", payMode)
				.append("payStatus", payStatus)
				.append("payAmount", payAmount)
				.append("payTime", payTime)
				.append("orderAmount", orderAmount)
				.append("chargeStartTime", chargeStartTime)
				.append("chargeEndTime", chargeEndTime)
				.append("startSOC", startSOC)
				.append("endSOC", endSOC)
				.append("reason", reason)
				.append("delFlag", delFlag)
				.append("orderDetailList", orderDetailList)
				.toString();
	}
}
