# DbPmsReportDataRangeEnum.java

    package cloud.wconnect.workperformance.cons.database;

    import lombok.AllArgsConstructor;
    import lombok.Getter;
    import org.apache.commons.lang3.StringUtils;

    import java.util.Arrays;

    /**
     * Enum: Database PMS Report Data Range
     *
     * @author zc
     * @date 2025/12/02
     */
    @Getter
    @AllArgsConstructor
    public enum DbPmsReportDataRangeEnum {

        // 1. Manager Flash ~ -1d
        MANAGER_FLASH_LAST_1_DAY(DbNotifyTypeEnum.MISSING_REPORT_MANAGER_FLASH_LAST_1_DAY.getType(), "-1,-1"),
        // 2. Manager Flash ~ -2d
        MANAGER_FLASH_LAST_2_DAY(DbNotifyTypeEnum.MISSING_REPORT_MANAGER_FLASH_LAST_2_DAY.getType(), "-2,-2"),
        // 3. Market Code Statistics ~ -1d
        MARKET_CODE_STATISTICS_LAST_1_DAY(DbNotifyTypeEnum.MISSING_REPORT_MARKET_CODE_STATISTICS_LAST_1_DAY.getType(), "-1,-1"),
        // 4. Market Code Statistics ~ -2d
        MARKET_CODE_STATISTICS_LAST_2_DAY(DbNotifyTypeEnum.MISSING_REPORT_MARKET_CODE_STATISTICS_LAST_2_DAY.getType(), "-2,-2"),
        // 5. History and Forecast -2d ~ 365d
        HF_LAST_2_DAY_TO_365_DAY(DbNotifyTypeEnum.MISSING_REPORT_HF_LAST_2_DAY_TO_365_DAY.getType(), "-2,365"),
        // 6. Occupancy Summary -2d ~ -1d
        OS_LAST_2_DAY_TO_LAST_1_DAY(DbNotifyTypeEnum.MISSING_REPORT_OS_LAST_2_DAY_TO_LAST_1_DAY.getType(), "-2,-1"),
        // 7. Market Segment Summary -2d ~ -1d
        MSS_LAST_2_DAY_TO_LAST_1_DAY(DbNotifyTypeEnum.MISSING_REPORT_MSS_LAST_2_DAY_TO_LAST_1_DAY.getType(), "-2,-1");

        /**
         * 报告分类
         */
        private final int type;
        /**
         * 报告数据范围
         */
        private final String dateRange;

        /**
         * Get date range
         *
         * @param type Report type
         * @return date range
         */
        public static String getDateRange(int type) {
            return Arrays.stream(DbPmsReportDataRangeEnum.values()).filter(value ->
                            value.getType() == type).findFirst().map(DbPmsReportDataRangeEnum::getDateRange)
                    .orElse(StringUtils.EMPTY);
        }
    }