/**
 * 审批顺序枚举，定义审批流程中各节点的顺序和类型
 *
 * @version 1.0
 * @since 2025
 */
package com.xdap.self_development.domain.enums;

import lombok.Getter;

@Getter
public enum ApprovalOrderEnum {

    /**
     * 校对
     */
    PROOFREAD(0,"校对"),
    /**
     * 审核
     */
    REVIEW(1,"审核"),
    /**
     * 会签
     */
    COUNTERSIGN(2,"会签"),
    /**
     * 批准
     */
    APPROVE(3,"批准");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 描述
     */
    private final String desc;

    ApprovalOrderEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public static ApprovalOrderEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (ApprovalOrderEnum status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

    public static ApprovalOrderEnum getByDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (ApprovalOrderEnum status : values()) {
            if (status.desc.equals(desc)) {
                return status;
            }
        }
        return null;
    }
}
