package com.njcn.device.pms.pojo.param;

import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.common.pojo.dto.SimpleDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.List;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2022年02月23日 19:04
 */
@Data
@ApiModel
@NoArgsConstructor
public class PmsDeviceInfoParam implements Serializable {

    /**
     * 统计类型
     */
    @ApiModelProperty(name = "statisticalType", value = "统计类型",required = true)
    @NotNull(message = "统计类型不可为空")
    private SimpleDTO statisticalType;

    @ApiModelProperty(name = "deptIndex", value = "部门索引",required = true)
    @NotBlank(message = "部门索引不可为空")
    private String deptIndex;


    @ApiModelProperty(name = "voltageLevel", value = "电压等级")
    private List<SimpleDTO> voltageLevel;


    @ApiModelProperty(name = "manufacturer", value = "终端厂家")
    private List<SimpleDTO> manufacturer;


    @ApiModelProperty(name = "monitorObjectType", value = "监测点对象类型")
    private List<SimpleDTO> monitorObjectType;


    @ApiModelProperty(name = "monitorState", value = "监测点状态")
    private List<SimpleDTO> monitorState;


    @ApiModelProperty(name = "upToGrid", value = "是否上送国网0-否 1-是")
    private Integer upToGrid;

    /**
     * 默认全部监测点
     * @param deptIndex 部门索引
     */
    public PmsDeviceInfoParam(String deptIndex) {
        this.deptIndex = deptIndex;
    }


    /**
     * 自定义上报方式、电网侧方式的统计
     */
    public PmsDeviceInfoParam(SimpleDTO statisticalType, String deptIndex,  List<SimpleDTO> voltageLevel, List<SimpleDTO> manufacturer, List<SimpleDTO> monitorObjectType, List<SimpleDTO> monitorState) {
        this.statisticalType = statisticalType;
        this.deptIndex = deptIndex;
        this.voltageLevel = voltageLevel;
        this.manufacturer = manufacturer;
        this.monitorObjectType = monitorObjectType;
        this.monitorState = monitorState;
    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class BusinessParam extends PmsDeviceInfoParam{

        @ApiModelProperty("开始时间")
        @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
        private String searchBeginTime;

        @ApiModelProperty("结束时间")
        @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
        private String searchEndTime;

        @ApiModelProperty("时间范围标志 0.查询展示天 1.查询展示月")
        private Integer timeFlag;

    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class CompareBusinessParam extends BusinessParam{

        @ApiModelProperty("比较开始时间")
        @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
        private String periodBeginTime;

        @ApiModelProperty("比较结束时间")
        @Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
        private String periodEndTime;

    }


}
