package com.zsElectric.boot.charging.vo;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;

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

@Data
@Accessors(chain = true)
@Schema(description = "充电订单信息VO")
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
public class ChargingOrderVO {

    @Schema(description = "充电订单号(格式:运营商ID+唯一编号)",
            example = "123456789201805071630123456",
            required = true)
    @JsonProperty("StartChargeSeq")
    private String StartChargeSeq;

    @Schema(description = "充电设备接口编码",
            example = "3702120244102_1",
            required = true)
    @JsonProperty("ConnectorID")
    private String ConnectorID;

    @Schema(description = "开始充电时间,格式\"yyyy-MM-dd HH:mm:ss\"",
            example = "2024-01-15 10:30:00",
            required = true)
    @JsonProperty("StartTime")
    private String StartTime;

    @Schema(description = "结束充电时间,格式\"yyyy-MM-dd HH:mm:ss\"",
            example = "2024-01-15 12:45:30",
            required = true)
    @JsonProperty("EndTime")
    private String EndTime;

    @Schema(description = "累计充电量,单位：度，小数点后4位",
            example = "25.6845",
            required = true)
    @JsonProperty("TotalPower")
    private BigDecimal TotalPower;

    @Schema(description = "总电费,单位：元，小数点后2位",
            example = "15.80",
            required = true)
    @JsonProperty("TotalElecMoney")
    private BigDecimal TotalElecMoney;

    @Schema(description = "总服务费,单位：元，小数点后2位",
            example = "3.20",
            required = true)
    @JsonProperty("TotalSeviceMoney")
    private BigDecimal TotalSeviceMoney;

    @Schema(description = "累计总金额,单位：元，小数点后2位",
            example = "19.00",
            required = true)
    @JsonProperty("TotalMoney")
    private BigDecimal TotalMoney;

    @Schema(description = "充电结束原因(0:用户手动停止充电;1:客户归属地运营商平台停止充电;2:BMS停止充电;3:充电机设备故障;4:连接器断开;其它:自定义)",
            example = "0",
            allowableValues = {"0", "1", "2", "3", "4"},
            required = true)
    @JsonProperty("StopReason")
    private Integer StopReason;

    @Schema(description = "时段数N,范围：0～32",
            example = "5")
    @JsonProperty("SumPeriod")
    private Integer SumPeriod;

    @Schema(description = "单时段充电明细信息")
    @JsonProperty("ChargeDetails")
    private List<ChargeDetail> ChargeDetails;

    @Data
    @Accessors(chain = true)
    @Schema(description = "充电明细信息体")
    @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE)
    public static class ChargeDetail {

        @Schema(description = "开始时间,格式\"yyyy-MM-dd HH:mm:ss\"",
                example = "2024-01-15 10:30:00",
                required = true)
        @JsonProperty("DetailStartTime")
        private String DetailStartTime;

        @Schema(description = "结束时间,格式\"yyyy-MM-dd HH:mm:ss\"",
                example = "2024-01-15 11:30:00",
                required = true)
        @JsonProperty("DetailEndTime")
        private String DetailEndTime;

        @Schema(description = "时段电价,小数点后2位",
                example = "0.65")
        @JsonProperty("ElecPrice")
        private BigDecimal ElecPrice;

        @Schema(description = "时段服务费价格,小数点后2位",
                example = "0.15")
        @JsonProperty("SevicePrice")
        private BigDecimal SevicePrice;

        @Schema(description = "时段充电量,单位：度，小数点后4位",
                example = "12.3456",
                required = true)
        @JsonProperty("DetailPower")
        private BigDecimal DetailPower;

        @Schema(description = "时段电费,小数点后2位",
                example = "8.02")
        @JsonProperty("DetailElecMoney")
        private BigDecimal DetailElecMoney;

        @Schema(description = "时段服务费,小数点后2位",
                example = "1.85")
        @JsonProperty("DetailSeviceMoney")
        private BigDecimal DetailSeviceMoney;
    }
}