# AdjReasonEnum.java

    package cloud.wconnect.frontoffice.cons.adjustment;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

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

    /**
     * @author lichen
     * @description adjustment 的 reason
     * @date 2023/4/3 10:28
     */
    @Getter
    @AllArgsConstructor
    public enum AdjReasonEnum {

        INCORRECT_COMPANY_RATE(1, "adjustment.reason.incorrect_company_rate"),
        GUEST_RELATION_COMPLAINT(2, "adjustment.reason.guest_relation_complaint"),
        OVER_PAYMENT(3, "adjustment.reason.over_payment"),
        CHANGE_CARD_AND_OTHER_PAY(4, "adjustment.reason.change_card_and_other_pay"),
        OTHER(6, "adjustment.reason.other"),
        CHARGEBACK(7, "adjustment.reason.chargeback"),
        DB_WRITE_OFF(8,"adjustment.reason.db_write_off"),
        MISPOSTING(9, "adjustment.reason.misposting"),
        FRAUD(10,"adjustment.reason.fraud");

        private int type;

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

        /**
         * 获取国际化code
         *
         * @param type adjustment 理由
         * @return java.lang.String
         * @author lichen
         * @date 2024/1/11
         */
        public static String getI18nCode(int type) {
            Optional<AdjReasonEnum> optional = Arrays.stream(AdjReasonEnum.values()).filter(item -> item.getType() == type).findFirst();
            return optional.isPresent() ? optional.get().getI18nCode() : "";
        }

    }