package com.fuyuanshen.equipment.enums;

/**
 * 设备有效性状态枚举
 *
 * @author: 默苍璃
 * @date: 2025-06-2113:26
 */
public enum DeviceActiveStatusEnum {

    INACTIVE(0, "无效"), ACTIVE(1, "有效");

    private final Integer code;
    private final String description;

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

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    /**
     * 根据 code 获取描述
     *
     * @param code 状态码
     * @return 描述信息
     */
    public static String getDescriptionByCode(Integer code) {
        for (DeviceActiveStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status.getDescription();
            }
        }
        return null;
    }
}

