# ApiStatusEnum.java

    package cloud.wconnect.finance.cons.api;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

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

    /**
     * Enum: Api Status
     *
     * @author zc
     * @date 2023/08/04
     */
    @Getter
    @AllArgsConstructor
    public enum ApiStatusEnum {

        /**
         * Missing in PMS
         */
        STATUS_MISSING_IN_PMS(1, "api.status.miss-pms"),

        /**
         * No record in PMS
         */
        STATUS_NO_RECORD_IN_PMS(2, "api.status.no-record-pms"),

        /**
         * Matched
         */
        STATUS_MATCHED(3, "api.status.matched"),

        /**
         * Pay & Close
         */
        STATUS_PAY_CLOSE(4, "api.status.pay-close");

        /**
         * code
         */
        private final int code;

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

        /**
         * 获取国际化 code
         *
         * @param code code
         * @return 国际化 code
         * @author zc
         * @date 2023/8/4
         */
        public static String getI18nCode(int code) {
            Optional<ApiStatusEnum> optional = Arrays.stream(ApiStatusEnum.values())
                    .filter(item -> item.getCode() == code).findFirst();
            return optional.isPresent() ? optional.get().getI18nCode() : "";
        }
    }