# DbNotifyTypeEnum.java

    package cloud.wconnect.workperformance.cons.database;

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

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

    /**
     * Enum: Database Notify Type
     *
     * @author zc
     * @date 2025/12/02
     */
    @Getter
    @AllArgsConstructor
    public enum DbNotifyTypeEnum {

        // 1. Manager Flash ~ -1d
        MISSING_REPORT_MANAGER_FLASH_LAST_1_DAY(1, NotifySubjectI18nCons.MISSING_REPORT, "database.notify.type.miss-report.manager-flash"),
        // 2. Manager Flash ~ -2d
        MISSING_REPORT_MANAGER_FLASH_LAST_2_DAY(2, NotifySubjectI18nCons.MISSING_REPORT, "database.notify.type.miss-report.manager-flash"),
        // 3. Market Code Statistics ~ -1d
        MISSING_REPORT_MARKET_CODE_STATISTICS_LAST_1_DAY(3, NotifySubjectI18nCons.MISSING_REPORT, "database.notify.type.miss-report.market-code"),
        // 4. Market Code Statistics ~ -2d
        MISSING_REPORT_MARKET_CODE_STATISTICS_LAST_2_DAY(4, NotifySubjectI18nCons.MISSING_REPORT, "database.notify.type.miss-report.market-code"),
        // 5. History and Forecast -2d ~ 365d
        MISSING_REPORT_HF_LAST_2_DAY_TO_365_DAY(5, NotifySubjectI18nCons.MISSING_REPORT, "database.notify.type.miss-report.hf");

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

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