package com.aegis.file.enums;

/**
 * 文件状态枚举
 * 
 * @author aegis
 */
public enum FileStatus {
    
    /** 正常 */
    NORMAL("normal", "正常"),
    
    /** 已删除 */
    DELETED("deleted", "已删除");
    
    private final String code;
    private final String info;
    
    FileStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getInfo() {
        return info;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static FileStatus fromCode(String code) {
        for (FileStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }
}