package com.ym.mec.biz.dal.entity;

import com.ym.mec.biz.dal.enums.IndexErrorType;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @Author Joburgess
 * @Date 2021/1/19 0019
 */
public class IndexErrInfoDto<T> {

    private IndexErrorType errorType;

    private String desc;

    private int num = 0;

    private int num2 = 0;

    private List<T> result;

    public IndexErrInfoDto() {
    }

    public IndexErrInfoDto(IndexErrorType errorType, String desc, int num, List<T> result) {
        this.errorType = errorType;
        this.desc = desc;
        this.num = num;
        this.result = result;
    }

    public IndexErrInfoDto(IndexErrorType errorType, String desc, List<T> result) {
        this.errorType = errorType;
        this.desc = desc;
        this.result = result;
        if(!CollectionUtils.isEmpty(result)){
            this.num = result.size();
        }
    }

    public IndexErrorType getErrorType() {
        return errorType;
    }

    public void setErrorType(IndexErrorType errorType) {
        this.errorType = errorType;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public int getNum2() {
        return num2;
    }

    public void setNum2(int num2) {
        this.num2 = num2;
    }

    public List<T> getResult() {
        return result;
    }

    public void setResult(List<T> result) {
        this.result = result;
    }
}
