package com.sundot.airport.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 用工形式枚举
 */
@Getter
@AllArgsConstructor
public enum EmploymentTypeEnum {

    DISPATCHED_WORKER("DISPATCHED_WORKER", "派遣工"),
    REGULAR_EMPLOYEE("REGULAR_EMPLOYEE", "正式工"),
    INTERN("INTERN", "实习生");

    private final String code;
    private final String desc;

    public static EmploymentTypeEnum getByCode(String code) {
        for (EmploymentTypeEnum itemEnum : values()) {
            if (itemEnum.getCode().equals(code)) {
                return itemEnum;
            }
        }
        return null;
    }

    public static EmploymentTypeEnum getByDesc(String desc) {
        for (EmploymentTypeEnum itemEnum : values()) {
            if (itemEnum.getDesc().equals(desc)) {
                return itemEnum;
            }
        }
        return null;
    }

}
