package com.njcn.csdevice.pojo.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 初始化模板实体
 * @author xy
 */
@Data
public class CsDevModelDto implements Serializable {

    @ApiModelProperty("模板id")
    private String id;

    @ApiModelProperty("版本号")
    private String versionNo;

    @TableField("版本日期")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date versionDate;

    @ApiModelProperty("模板名称")
    private String name;

    @ApiModelProperty("设备类型名称")
    private String devTypeName;

    @ApiModelProperty("模板存储路径")
    private String filePath;

    @ApiModelProperty("模板类型(0:治理类型 1:电能质量类型)")
    private Integer type;

    @ApiModelProperty("数据集")
    private List<CsDataSet> dataSets;

    @Data
    public static class CsDataSet implements Serializable {

        @ApiModelProperty("数据集id")
        private String id;

        @ApiModelProperty("模板id")
        private String pid;

        @ApiModelProperty("数据集名称")
        private String name;

        @ApiModelProperty("数据集别名")
        private String anotherName;

        @ApiModelProperty("数据集编号")
        private Integer idx;

        @ApiModelProperty("数据集类型")
        private String dataType;

        @ApiModelProperty("统计周期")
        private Integer period;

        @ApiModelProperty("是否存储 0:不存储 1:存储")
        private Integer storeFlag;

        @ApiModelProperty("逻辑子设备")
        private Integer clDev;

        @ApiModelProperty("数据集类型(0:主设备 1:子模块 2:监测设备)")
        private Integer type;

        @ApiModelProperty("数据类型(Primary:一次值  Secondary:二次值)")
        private String dataLevel;

        @ApiModelProperty("数据类型")
        private List<CsDataArray> dataArrays;
    }

    @Data
    public static class CsDataArray implements Serializable {

        @ApiModelProperty("指标id")
        private String id;

        @ApiModelProperty("数据集id")
        private String pid;

        @ApiModelProperty("字典表id")
        private String dataId;

        @ApiModelProperty("数据集名称")
        private String name;

        @ApiModelProperty("数据集别名")
        private String anotherName;

        @ApiModelProperty("数据集编号")
        private Integer idx;

        @ApiModelProperty("数据统计方法(max、min、avg、cp95)")
        private String statMethod;

        @ApiModelProperty("数据类型")
        private String dataType;

        @ApiModelProperty("相别")
        private String phase;

        @ApiModelProperty("排序")
        private Integer sort;
    }

}
