package com.ningdatech.carapi.driver.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 = "ApplicantTypeEnum", description = "驾驶员培训报名申请类型-枚举")
public enum ApplicantTypeEnum {

    /**
     * 材料审核
     */
    MATERIAL_APPLICANT(1, "材料审核"),

    /**
     * 跳槽审核
     */
    JOB_CHANGE_APPLICANT(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 (ApplicantTypeEnum t : ApplicantTypeEnum.values()) {
            if (code == t.getCode()) {
                return t.desc;
            }
        }
        return StringUtils.EMPTY;
    }

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

}
