# HotelKpiNotifyTypeEnum.java

    package cloud.wconnect.workperformance.cons.hotelkpi;

    import cloud.wconnect.commonlib.cons.NotifySubjectI18nCons;
    import lombok.AllArgsConstructor;
    import lombok.Getter;

    import java.util.Arrays;
    import java.util.Optional;

    /**
     * Enum: Notify Type
     *
     * @author zc
     * @date 2024/11/12
     */
    @Getter
    @AllArgsConstructor
    public enum HotelKpiNotifyTypeEnum {

        // 1. History and Forecast -30 ~ 100 天
        MISSING_REPORT_HISTORY_AND_FORECAST(1, NotifySubjectI18nCons.MISSING_REPORT, "hotel-kpi.notify.type.miss-report.history-and-forecast"),
        // 2. Manager Flash ~ -1 天
        MISSING_REPORT_MANAGER_FLASH(2, NotifySubjectI18nCons.MISSING_REPORT, "hotel-kpi.notify.type.miss-report.manager-flash"),
        // 3. History and Forecast Business Block -30 ~ 100 天
        MISSING_REPORT_HISTORY_AND_FORECAST_BUSINESS_BLOCK(3, NotifySubjectI18nCons.MISSING_REPORT, "hotel-kpi.notify.type.miss-report.history-and-forecast-business-block");

        /**
         * 通知类型
         */
        private final Integer type;
        /**
         * 默认通知主题的国际化code
         */
        private final String defaultSubjectI18nCode;
        /**
         * 国际化code
         */
        private final String i18nCode;

        /**
         * 根据类型获取默认主题的国际化code
         *
         * @param type 类型
         * @return java.lang.String
         * @author zc
         * @date 2024/11/13
         */
        public static String getDefaultSubjectI18nCode(int type) {
            Optional<HotelKpiNotifyTypeEnum> optional = Arrays.stream(HotelKpiNotifyTypeEnum.values())
                    .filter(item -> item.getType() == type).findFirst();
            return optional.isEmpty() ? "" : optional.get().getDefaultSubjectI18nCode();
        }
    }