package com.xy.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xy.entity.SysCodeConfigureRedis;
import com.xy.utils.PageBean;
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.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 机器-消息表
 * </p>
 *
 * @author lijin
 * @since 2023-01-09
 */
public class DeviceEventMsgDto {

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

        @ApiModelProperty(value = "分页对象", required = true)
        private PageBean page;

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

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

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

        @NotNull(message = "deviceId不能为空")
        @ApiModelProperty(value = "设备编号", required = true)
        private Long deviceId;
    }

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

        @ApiModelProperty(value = "id")
        private List<Integer> ids;

        @ApiModelProperty(value = "设备编号")
        private List<Long> deviceIds;
    }

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

        @NotEmpty(message = "codes不能为空")
        @ApiModelProperty(value = "编码")
        private List<String> codes;

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

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

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

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

        @ApiModelProperty(value = "商户ID")
        private Long mercId;

        @ApiModelProperty(value = "设备编号")
        private Long deviceId;

        @ApiModelProperty(value = "消息编码")
        private String code;

        @ApiModelProperty(value = "消息内容")
        private String msg;

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

        @ApiModelProperty(value = "设备名称")
        private String deviceName;

        @ApiModelProperty(value = "消息编码详情")
        private SysCodeConfigureRedis sysCodeConfigureRedis;

    }

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

        @ApiModelProperty(value = "消息编码")
        private String code;

        @ApiModelProperty(value = "条数")
        private Long count;
    }

}
