package com.ruoyi.asset.domain.enums;

/**
 * 资产管理状态
 */
public enum ManageStatus {
    NORMAL(0L, "正常"),
    ADJUSTMENT(1L, "调整"),
    ALLOT(2L, "调拨"),
    BORROW(3L, "借出"),
    SPLIT(4L, "拆分"),
    LEAVE_UNUSED(5L, "闲置"),
    START_USING(6L, "启用"),
    SCRAP(7L, "报废"),
    SALE(8L, "变卖");

    /** 特定代码 */
    private final Long code;

    /** 名称 */
    private final String name;

    ManageStatus(Long code, String name) {
        this.code = code;
        this.name = name;
    }

    public Long getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据特定代码返回名称
     *
     * @param code 特定代码
     * @return 名称/null
     */
    public static String getName(Integer code) {
        for (ManageStatus value : ManageStatus.values()) {
            if (value.code.equals(code)) {
                return value.getName();
            }
        }
        return null;
    }
}
