package com.xy.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 设备计费配置表
 * </p>
 *
 * @author lijin
 * @since 2023-07-28
 */
public class DeviceChargingConfigDto {

    @Data
    @Accessors(chain = true)
    public static class SelectList extends Vo {

        @NotNull(message = "mercId不能为空")
        @ApiModelProperty(value = "商户id", required = true)
        private Long mercId;

        @NotNull(message = "deviceType不能为空")
        @ApiModelProperty(value = "设备类型", required = true)
        private Integer deviceType;
    }

    @Data
    @Accessors(chain = true)
    public static class SaveOrUpdate {

        @NotNull(message = "mercId不能为空")
        @ApiModelProperty(value = "商户id", required = true)
        private Long mercId;

        @NotNull(message = "deviceType不能为空")
        @ApiModelProperty(value = "设备类型", required = true)
        private Integer deviceType;

        @NotEmpty(message = "values不能为空")
        @ApiModelProperty(value = "参数值", required = true)
        private List<ConfigValue> configValues;

        @ApiModelProperty(value = "备注")
        private String note;

        @Data
        @Accessors(chain = true)
        public static class ConfigValue {

            @NotNull(message = "type不能为空")
            @ApiModelProperty(value = "类型", required = true)
            private Integer type;

            @NotNull(message = "values不能为空")
            @ApiModelProperty(value = "赠送天数/预充金额", required = true)
            private Integer configValue;
        }
    }

    @Data
    @Accessors(chain = true)
    public static class Vo {

        @ApiModelProperty(value = "id")
        private Long id;

        @ApiModelProperty(value = "商户编码")
        private String mercCode;

        @ApiModelProperty(value = "设备类型")
        private Integer deviceType;

        @ApiModelProperty(value = "赠送天数/预充金额")
        private Integer configValue;

        @ApiModelProperty(value = "备注")
        private String note;

        @ApiModelProperty(value = "类型")
        private Integer type;

        @ApiModelProperty(value = "创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createTime;

        @ApiModelProperty(value = "更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updateTime;


    }

}
