package jnpf.model.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;

/**
 * @Title:FtbPersonnelsAuditTaskEnum
 * @Author:peng.hao
 * @create: 2024/2/214:38
 */
@Getter
@RequiredArgsConstructor
public enum FtbPersonnelsAuditTaskEnum {
    //0,待审批,1 审批中,2,审核通过,3,审核不通过,4,撤销,5 未办理, 6 手动,7 逾期未审批
    PENDING(0, "待审批"),
    UNDER_REVIEW(1, "审批中"),
    EXAMINATION_PASSED(2, "审核通过"),
    AUDIT_NOT_PASSED(3, "审核不通过"),
    CANCEL(4, "已撤销"),
    NOT_PROCESSED(5, "未办理"),
    MANUAL_CONTROL(6, "手动"),
    @Deprecated
    OVERDUE_FOR_APPROVAL(7, "逾期未审批");

    private final Integer code;
    private final String message;

    public static String getMessage(Integer code) {
        FtbPersonnelsAuditTaskEnum[] values = FtbPersonnelsAuditTaskEnum.values();
        for (FtbPersonnelsAuditTaskEnum value : values) {
            if (Objects.equals(value.getCode(), code)) {
                return value.getMessage();
            }
        }
        return null;
    }

    public static FtbPersonnelsAuditTaskEnum getCode(int code) {
        FtbPersonnelsAuditTaskEnum[] values = FtbPersonnelsAuditTaskEnum.values();
        for (FtbPersonnelsAuditTaskEnum value : values) {
            if (Objects.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }
}
