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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * <p>
 * MeetingDateTermType
 * </p>
 *
 * @author WendyYang
 * @since 09:54 2022/8/15
 */
@Getter
@AllArgsConstructor
public enum MeetingDateTermTypeEnum {

    /**
     * 会议日期类型
     */
    ONE_DAY(1, "一天"),
    MORE_THAN_ONE(2, "两天及以上");

    private final Integer code;
    private final String value;

    public static MeetingDateTermTypeEnum getByCode(Integer code) {
        return Arrays.stream(values())
                .filter(w -> w.getCode().equals(code))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("无效的会议日期类型编码"));
    }

}
