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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * MeetingStatus
 * </p>
 *
 * @author WendyYang
 * @since 11:14 2022/8/8
 */
@Getter
@AllArgsConstructor
public enum MeetingStatusEnum {

    /**
     * 会议状态
     */
    NORMAL("正常", 1),
    CANCELED("已取消", 3);

    private final String value;
    private final Integer code;

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

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

}
