package com.fizz.business.constants.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

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

/**
 * 计划类型枚举
 *
 * @author chenhao
 * @date 2023/04/24
 */
@Getter
@AllArgsConstructor
public enum PlanTypeEnum implements IEnum<String> {
    PLAN_MAT("计划卷"),
    TEMP_MAT("临时卷"),
    BLOCK_MAT("封闭卷")
    ;

    private final String desc;

    private static final Map<String, PlanTypeEnum> MAP = new HashMap<>(5);

    static {
        for (PlanTypeEnum e : PlanTypeEnum.values()) {
            MAP.put(e.getValue(), e);
        }
    }

    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static PlanTypeEnum getByValue(String value) {
        return MAP.get(value);
    }

    @JsonValue
    @Override
    public String getValue() {
        return this.name();
    }
}
