# FbTypeEnum.java

    package cloud.wconnect.rateshop.cons.budgetdatabase;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

    import java.util.Map;

    /**
     * @author: yyt
     * 2025-08-14
     */
    @AllArgsConstructor
    @Getter
    public enum FbTypeEnum {

        // 注意：增加类型时，需要修改 DESC_BY_CODE，同时需调整导出模板
        // 1.Restaurant，2.Banquets，3.Restaurant And Room Service，4.Banquet，0.total
        RESTAURANT(1, "restaurant", "subtotal-restaurant", -1),
        BANQUET(2, "banquets", "subtotal-banquets", -2),
        STATISTICS_COVERS_RESTAURANT(3, "statisticsCoversRestaurant", "statistics-covers-subtotal-restaurant", -1),
        STATISTICS_COVERS_BANQUET(4, "statisticsCoversBanquet", "subtotal-banquets", -2),
        TOTAL(0, "total", "budget-database.total", 0);

        private final Integer code;
        private final String desc;
        private final String i18nDesc;
        private final Integer rowId;
        public static final Map<Integer, String> DESC_BY_CODE = Map.of(RESTAURANT.getCode(), RESTAURANT.getDesc(),
                BANQUET.getCode(), BANQUET.getDesc(),
                STATISTICS_COVERS_RESTAURANT.getCode(), STATISTICS_COVERS_RESTAURANT.getDesc(),
                STATISTICS_COVERS_BANQUET.getCode(), STATISTICS_COVERS_BANQUET.getDesc(),
                TOTAL.getCode(), TOTAL.getDesc());
        public static final Map<Integer, Integer> ROW_ID_BY_CODE = Map.of(RESTAURANT.getCode(), RESTAURANT.getRowId(),
                BANQUET.getCode(), BANQUET.getRowId(),
                STATISTICS_COVERS_RESTAURANT.getCode(), STATISTICS_COVERS_RESTAURANT.getRowId(),
                STATISTICS_COVERS_BANQUET.getCode(), STATISTICS_COVERS_BANQUET.getRowId(),
                TOTAL.getCode(), TOTAL.getRowId());
        public static final Map<String, String> I18N_DESC_BY_DESC = Map.of(RESTAURANT.getDesc(), RESTAURANT.getI18nDesc(),
                BANQUET.getDesc(), BANQUET.getI18nDesc(),
                STATISTICS_COVERS_RESTAURANT.getDesc(), STATISTICS_COVERS_RESTAURANT.getI18nDesc(),
                STATISTICS_COVERS_BANQUET.getDesc(), STATISTICS_COVERS_BANQUET.getI18nDesc(),
                TOTAL.getDesc(), TOTAL.getI18nDesc());

        public static String getDesc(Integer code) {
            return DESC_BY_CODE.get(code);
        }

        public static Integer getRowId(Integer type) {
            return ROW_ID_BY_CODE.get(type);
        }

        public static String getI18nDesc(String desc) {
            return I18N_DESC_BY_DESC.get(desc);
        }

    }