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.NotNull;
import javax.validation.constraints.Pattern;
import java.time.LocalDateTime;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2022/3/8 20:19
 */
@Data
public class DataModelParam {

    @ApiModelProperty(value = "数据模板名称")
    @NotEmpty(message = "数据模板名称不可为空")
    private String name;

    @ApiModelProperty(value = "设备模板编号")
    @NotNull(message = "设备模板编号不可为空")
    private Integer idx;

    @ApiModelProperty(value = "版本号")
    private String version;

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

    @ApiModelProperty(value = "创建时间",required = true)
    private LocalDateTime createTime;

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

        @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 DataModelQueryParam extends BaseParam {


    }

}
