package com.xy.dto;

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

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
 * <p>
 * 设备-日志
 * </p>
 *
 * @author lijin
 * @since 2023-03-16
 */
public class DeviceLogDto {

    @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 beginLogBeginTime;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "日志截取开始时间-始")
        private LocalDateTime endLogBeginTime;

    }

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

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

        @NotBlank(message = "logName不能为空")
        @ApiModelProperty(value = "日志名称", required = true)
        private String logName;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "日志截取开始时间", required = true)
        private LocalDateTime logBeginTime;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "日志截取结束时间", required = true)
        private LocalDateTime logEndTime;

        @NotBlank(message = "type不能为空")
        @ApiModelProperty(value = "日志类型")
        private String type;
    }

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

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

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

        @ApiModelProperty(value = "日志名称")
        private String logName;

        @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;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "日志截取开始时间")
        private LocalDateTime logBeginTime;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @ApiModelProperty(value = "日志截取结束时间")
        private LocalDateTime logEndTime;

        @ApiModelProperty(value = "日志类型")
        private String type;
    }

}
