# PlatformEnum.java

    package cloud.wconnect.rateshop.cons.rateshop;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

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

    /**
     * 平台的枚举类
     *
     * @author lichen
     * @date 2023/6/7
     */
    @AllArgsConstructor
    @Getter
    public enum PlatformEnum {

        /**
         * 官网
         */
        BRAND(0, "rate-shop.platform.brand"),
        BOOKING_COM(1, "rate-shop.platform.booking_com"),
        PRICELINE_COM(2, "rate-shop.platform.priceline_com"),
        HOTELS_COM(3, "rate-shop.platform.hotels_com"),
        EXPEDIA_COM(4, "rate-shop.platform.expedia_com"),
        AGODA(5, "rate-shop.platform.agoda"),
        OPTIMAND(6, "rate-shop.platform.optimand"),
        MERLIN(7, "rate-shop.platform.merlin");

        /**
         * 平台code(或平台id)
         */
        private int code;

        /**
         * 国际化code
         */
        private String i18nCode;

        /**
         * 获取平台的国际化code
         *
         * @param code 平台标识
         * @return java.lang.String
         * @author lichen
         * @date 2024/5/31
         */
        public static String getI18nCode(int code) {
            Optional<PlatformEnum> optional = Arrays.stream(PlatformEnum.values()).filter(platformEnum -> platformEnum.getCode() == code).findAny();
            return optional.isPresent() ? optional.get().getI18nCode() : "";
        }

    }