package com.ningdatech.pmapi.expert.model.enumeration;

import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * ReviewTemplateTypeEnum
 * </p>
 *
 * @author WendyYang
 * @since 09:48 2023/2/15
 */
@Getter
public enum ReviewTemplateTypeEnum {
    /**
     * 评审模版类型
     */
    PRELIMINARY_SCHEME_REVIEW("初步方案评审", 1),

    CONSTRUCTION_SCHEME_REVIEW("建设方案评审", 2),

    ACCEPTANCE_SCHEME_REVIEW("验收方案评审", 3);


    private final String value;
    private final Integer code;

    ReviewTemplateTypeEnum(String value, Integer code) {
        this.value = value;
        this.code = code;
    }

    public boolean eq(Integer code) {
        return this.getCode().equals(code);
    }

    public static ReviewTemplateTypeEnum getByCode(Integer code) {
        return Arrays.stream(values())
                .filter(w -> w.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("评审模版类型编码无效"));
    }

}
