package com.srs.common.enums;

public enum ApplicationStatus {
    /**
     * 待审批状态
     */
    PENDING_APPROVAL("0", "待审批"),
    /**
     * 已通过状态
     */
    APPROVED("1", "已通过"),
    /**
     * 已驳回状态
     */
    REJECTED("2", "已驳回"),

    /**
     * 不同意状态
     */
    DISAGREED("3", "不同意");

    private String code;
    private String description;

    ApplicationStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据code获取枚举值
     * @param code 状态码
     * @return 枚举实例
     */
    public static ApplicationStatus fromCode(String code) {
        for (ApplicationStatus status : values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid code for ApplicationStatus: " + code);
    }
}

