/**
 * 参数值版本枚举，定义参数值的不同版本状态
 *
 * @version 1.0
 * @since 2025
 */
package com.xdap.self_development.domain.enums;

import lombok.Getter;

@Getter
public enum ParamValueVersionEnum {

    /**
     * 已通过
     */
    PASSED(0,"已通过"),
    /**
     * 草稿
     */
    DRAFT(1,"草稿"),
    /**
     * 审核中
     */
    UNDER(2,"审核中"),
    /**
     * 已撤回
     */
    WITHDRAWN(3,"已撤回"),
    /**
     * 已拒绝
     */
    REFUSE(4,"已拒绝");

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

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


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

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