package com.yifu.cloud.plus.v1.yifu.common.core.util;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * @author fang
 */
@Data
public class ErrorMessage<T>  implements Serializable {
    /**
     * 行数或INDEX
     */
    private Integer lineNum;
    //默认红色 success green
    private String color = "red";

	private Set<String> errors = new HashSet();

    /**
     * @param 用于展示勾选的名称
     * @Author: fxj
     **/
    private String name;
    private String key;
    /**
     * 错误信息
     */
    private String message;
	/**
	 * 数据
	 */
	private T data;

	// 添加默认构造函数
	public ErrorMessage() {
	}

    public ErrorMessage(Integer lineNum, String message) {
        this.lineNum = lineNum;
		this.color = "red";
        this.message = message;
    }
	public ErrorMessage(Integer lineNum, String message, T t) {
		this.lineNum = lineNum;
		this.color = "red";
		this.message = message;
		this.data = t;
	}
    public ErrorMessage(Integer lineNum, String message, String color) {
        this.lineNum = lineNum;
        this.color = color;
        this.message = message;
    }

	public ErrorMessage(Integer lineNum, String message, String color, T t) {
		this.lineNum = lineNum;
		this.color = color;
		this.message = message;
		this.data = t;
	}

    public ErrorMessage(Integer lineNum, String message, String color, String name) {
        this.lineNum = lineNum;
        this.color = color;
        this.message = message;
        this.name= name;
    }

	public ErrorMessage(Integer lineNum, String message, String color, String name, String key) {
        this.lineNum = lineNum;
        this.color = color;
        this.message = message;
        this.name= name;
        this.key= key;
    }

	public ErrorMessage(Integer lineNum, Set<String> errors) {
		this.lineNum = lineNum;
		this.errors = errors;
	}
}
