package com.ningdatech.pmapi.expert.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * ReviewResultEnum
 * </p>
 *
 * @author WendyYang
 * @since 14:17 2023/3/20
 */
@Getter
@AllArgsConstructor
public enum ReviewResultEnum {

    PASSED(1, "通过"),
    TO_BE_REVIEWED(2, "需复核"),
    REFUSED(3, "不通过");

    private final int code;
    private final String value;

    public static ReviewResultEnum getByCode(int code) {
        return Arrays.stream(values())
                .filter(w -> w.getCode() == code)
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("无效的审核结果编码"));
    }

}
