package com.hz.pm.api.meeting.entity.enumeration;

import com.ningdatech.basic.exception.BizException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * AvoidTypeEnum
 * </p>
 *
 * @author WendyYang
 * @since 2023/8/17
 **/
@Getter
@AllArgsConstructor
public enum AvoidTypeEnum {

    CURR_UNIT(1, "同单位"),
    CURR_STRIP(2, "同条线"),
    NONE(3, "不回避");

    private final Integer code;
    private final String remark;

    public static AvoidTypeEnum getByCode(int code) {
        return Arrays.stream(values())
                .filter(w -> w.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> BizException.wrap("回避类型无效"));
    }

}
