package com.brilliance.isc.vo;

import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
public class WarnVo {

    public static final String LEVEL_IMPORTANT = "1";

    public static final String LEVEL_GENERAL = "2";

    public static final String LEVEL_TIPS = "3";

    public static final String SOURCE_FRONT = "F";

    public static final String SOURCE_BACK = "B";


    /**
     * 警告ID，为字段路径
     */
    private String id;

    /**
     * 警告级别
     * 1、重要
     * 2、一般
     * 3、提示
     */
    private String level;

    /**
     * 消息内容
     */
    private String message;

    /**
     * 消息来源
     *  F - 前端生成
     *  B - 后端生成
     */
    private String source;

    /**
     *  警告SUBID
     */
    private String subId;

    /**
     *  是否已读
     *  Y - 前端已读
     *  N - 前端未读
     */
    private String readFlag = "N";

    /**
     *  警告的唯一识别
     */
    private String key;

    /**
     * 参与warning计算的栏位值
     */
    private Object[] val;

    public String getKey() {
        return id + "_" + subId + "_" + source;
    }


    @Override
    public String toString() {
        StringBuilder valStr=new StringBuilder();
        if(val!=null && val.length>0){
            for(Object tmp:val){
                valStr.append(tmp).append("|");
            }
        }
        return "WarnVo{" +
                "id='" + id + '\'' +
                ", level='" + level + '\'' +
                ", message='" + message + '\'' +
                ", source='" + source + '\'' +
                ", subId='" + subId + '\'' +
                ", readFlag='" + readFlag + '\'' +
                ", key='" + key + '\'' +
                ", val='" + valStr.toString() + '\'' +
                '}';
    }
}
