package com.zcloud.basic.info.domain.enums;

import lombok.Getter;

/**
 * 入入职状态，0-离职, 1-在职, 2-信息变更中, 3-未入职, 4-实习生, 5-实习结束, 6-退休, 7-劳务派遣, 8-劳务派遣结束, 11-入职待审核, 10-离职待审核',
 *
 */
@Getter
public enum UserEmploymentFlagEnum {
    /**
     * 枚举值
     */
    RESIGNATION(0, "离职"),
    ON(1, "在职"),
    INFO_CHANGE(2, "信息变更中"),
    NOT_ON(3, "未入职"),
    INTERN(4, "实习生"),
    INTERNSHIP_ENDED(5, "实习结束"),
    RETIREMENT(6, "退休"),
    LABOR_DISPATCH(7, "劳务派遣"),
    END_OF_LABOR_DISPATCH(8, "劳务派遣结束"),
    ENTRY_AUDIT(11, "入职待审核"),
    RESIGNATION_AUDIT(10, "离职待审核"),
    ;
    private final Integer code;
    private final String desc;

    UserEmploymentFlagEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    //根据code获取枚举值
    public static UserEmploymentFlagEnum getByCode(Integer code) {
        for (UserEmploymentFlagEnum item : values()) {
            if (item.getCode().equals(code)) {
                return item;
            }
        }
        return null;
    }

    //根据枚举获取code
    public static UserEmploymentFlagEnum getByDesc(String desc) {
        for (UserEmploymentFlagEnum item : values()) {
            if (item.getDesc().equals(desc)) {
                return item;
            }
        }
        return null;
    }
}
