package com.ningdatech.pmapi.meeting.entity.enumeration;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * 专家参会状态
 * </p>
 *
 * @author WendyYang
 * @since 20:30 2023/3/2
 */
@Getter
@AllArgsConstructor
public enum MeetingAttendStatusEnum {

    TO_ATTEND("待参加", 1),
    ATTENDED("已参加", 2),
    ON_LEAVE("已请假", 3),
    UN_ATTEND("缺席", 4);

    private final String value;
    private final Integer code;

    public static MeetingAttendStatusEnum getByCode(Integer code) {
        return Arrays.stream(values())
                .filter(w -> w.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("专家参会状态编码无效"));
    }

}