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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * ExpertAttendStatus
 * </p>
 *
 * @author WendyYang
 * @since 09:23 2022/8/9
 */
@Getter
@AllArgsConstructor
public enum ExpertAttendStatusEnum {

    NOTICING("通知中", 0),
    UNANSWERED("未应答", 1),
    AGREED("同意参加", 3),
    REFUSED("拒绝参加", 4),
    RELEASED("已释放", 7);

    private final String value;
    private final Integer code;

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

    public static ExpertAttendStatusEnum getByCode(Integer code) {
        return Arrays.stream(values())
                .filter(w -> w.eq(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("无效的邀请状态"));
    }

}