package com.ningdatech.carapi.report.constant;

import java.util.Objects;

import org.apache.commons.lang3.StringUtils;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 直报系统上报数据类型
 * @return
 * @author CMM
 * @since 2023/02/07 13:55
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "QueryTypeEnum", description = "直报系统上报查询类型-枚举")
public enum QueryTypeEnum {

    /**
     * 审核列表查询
     */
    AUDIT_LIST(1,"审核列表查询"),

    /**
     * 查询列表查询
     */
    QUERY_LIST(2, "查询列表查询"),;

    private Integer code;
    private String desc;


    public String getDesc() {
        return desc;
    }

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

    public static String getDescByCode(int code) {
        if(Objects.isNull(code)){
            return StringUtils.EMPTY;
        }
        for (QueryTypeEnum t : QueryTypeEnum.values()) {
            if (code == t.getCode()) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

    public boolean eq(String val) {
        return this.name().equals(val);
    }

}
