package com.tofly.gpsboot.common.system;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 计划状态
 * @author Zev
 */
@Getter
@AllArgsConstructor
public enum PlanStateEnum {
    /**
     *
     */
    PLAN_STATE_NOT_SUBMITTED("0","未提交"),
    PLAN_STATE_NOT_AUDIT("1","未审核"),
    PLAN_STATE_NOT_START("2","已开始"),
    PLAN_STATE_BEING_PERFORMED("3","正在执行"),
    PLAN_STATE_PLAN_COMPLETE("4","计划完成"),
    PLAN_STATE_EXECUTION_NOT_STARTED("5","已开始未执行"),
    PLAN_STATE_APPLY_SUSPENSION("7","申请暂停"),
    PLAN_STATE_PROJECT_SUSPENDED("8","计划已暂停"),
    PLAN_STATE_APPLY_CANCELLATION("9","申请作废"),
    PLAN_STATE_PLAN_DISUSE("10","计划已作废"),
    PLAN_STATE_PLAN_UNFINISHED("11","计划未完成,已超时"),
    PLAN_STATE_UNENFORCEABLE("12","未到开始时间,不可执行")
    ;
    /**
     * 编码
     */
    private String code;
    /**
     * 内容
     */
    private String value;

    public static String getCodeForValue(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (PlanStateEnum e : PlanStateEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.value;
                break;
            }
        }
        return path;
    }
}
