package com.cool.store.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
 * @Author suzhuhong
 * @Date 2023/6/9 16:17
 * @Version 1.0
 */
public enum WorkflowStageEnum {

    INTENT(1,"意向申请阶段"),
    STORE(2,"新店进展"),
    ;

    private Integer code;

    private String message;

    WorkflowStageEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    protected static final Map<Integer, WorkflowStageEnum> map = Arrays.stream(values()).collect(
            Collectors.toMap(WorkflowStageEnum::getCode, Function.identity()));

    public static WorkflowStageEnum getWorkflowStageByCode(String code) {
        if(StringUtils.isBlank(code)) {
            return null;
        }
        return map.get(code);
    }
}
