package com.zcxk.rmcp.api.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author Andy
 * @description 更换方案
 * @date 2021-07-20 11:40
 */
@Getter
public enum ReplaceMethodEnum {

    /**
     * 更换模块
     */
    OPEN(1, "更换模块"),

    /**
     * 更换整表
     */
    CLOSE(2, "更换整表"),
    ;

    /**
     * code
     */
    private final Integer code;

    /**
     * 说明
     */
    private final String message;


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

    public static String getMessage(Integer code) {
        Optional<ReplaceMethodEnum> optional = Arrays.stream(ReplaceMethodEnum.values())
                .filter(p -> p.getCode().equals(code))
                .findFirst();
        return optional.get().getMessage();
    }
}
