package com.huashe.park.common.consts.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * The enum Cons status.
 */
public enum ConsStatus {
    /**
     * Cons status 00 cons status.
     */
    CONS_STATUS_00("00", "已施工"),
    /**
     * Cons status 02 cons status.
     */
    CONS_STATUS_02("02", "施工中"),
    /**
     * Cons status 01 cons status.
     */
    CONS_STATUS_01("01", "未施工");

    private final String code;

    private final String info;

    private static final Map<String, ConsStatus> dic = new HashMap<>();

    static {
        for (ConsStatus status : values()) {
            dic.put(status.code, status);
        }
    }

    ConsStatus(String code, String info) {
        this.code = code;
        this.info = info;
    }

    /**
     * Gets code.
     *
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * Gets info.
     *
     * @return the info
     */
    public String getInfo() {
        return info;
    }

    public static ConsStatus getByCode(String code) {
        if (!dic.containsKey(code)){
            return CONS_STATUS_01;
        }
        return dic.get(code);
    }
}
