package com.njcn.energy.pojo.param;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2022/3/7 19:02
 */
@Data
public class DevVersionParam{


    /**
     * 网关id
     */
    @ApiModelProperty(value = "网关id",required = true)
    @NotBlank(message = "网关id不可为空")
    private String ndid;


    /**
     * 设备类型（0：联网设备；1：逻辑设备）
     */
    @ApiModelProperty(value = "设备类型",required = true)
    @NotEmpty(message = "设备类型不可为空")
    private Integer type;

    /**
     * 版本号
     */
    @ApiModelProperty(value = "版本号",required = true)
    @NotBlank(message = "版本号不可为空")
    private String version;

    /**
     * 创建或最后修改时间
     */
    @ApiModelProperty(value = "创建或最后修改时间",required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime time;

    /**
     * 创建或最后修改时间
     */
    @ApiModelProperty(value = "创建时间",required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    /**
     * 更新操作实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class DevVersionUpdateParam extends DevVersionParam {

        @ApiModelProperty("id")
        @NotBlank(message = ValidMessage.ID_NOT_BLANK)
        @Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
        private String id;
    }

    /**
     * 分页查询实体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class DevVersionQueryParam extends BaseParam {


    }


}
