package com.ningdatech.carapi.industry.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * LabWorkerCertificateTypeEnum
 * </p>
 *
 * @author WendyYang
 * @since 11:26 2022/11/8
 */
@Getter
public enum LabWorkerCertificateTypeEnum {

    /**
     * 实验室人员从业资格证
     */
    QUALIFICATION(1, "实验室人员从业资格证"),
    EDUCATION(2, "实验室从业人员继续教育合格证");

    private final int code;

    private final String value;

    LabWorkerCertificateTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static LabWorkerCertificateTypeEnum getByCode(int code) {
        return Arrays.stream(values())
                .filter(w -> w.getCode() == code)
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("无效的证书类型编码"));
    }

}
