package com.yuchen.saas.payment.api.enums;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.Objects;

@Data
public class RefundEnum {

    @Getter
    @AllArgsConstructor
    public enum RefundTypeEnum {

        ALL_REFUND(1, "全部退款"),
        OTHER_REFUND(2, "部分退款"),
        ;

        private final int code;
        private final String desc;

        public static String getDescByCode(Integer code) {
            if (Objects.isNull(code)) {
                return null;
            }
            RefundTypeEnum[] enumArray = RefundTypeEnum.values();
            for (RefundTypeEnum e : enumArray) {
                if (e.getCode() == code) {
                    return e.getDesc();
                }
            }
            return "";
        }

    }


    @Getter
    @AllArgsConstructor
    public enum CostTypeEnum {

        PARK_CARD_COST(1, "停车卡费"),
        PARK_COST(2, "停车费"),
        WALLET_COST(3, "钱包费用"),
        CHARGE_COST(4, "充电费用"),
        ;

        private final int code;
        private final String desc;

        public static String getDescByCode(Integer code) {
            if (Objects.isNull(code)) {
                return null;
            }
            CostTypeEnum[] enumArray = CostTypeEnum.values();
            for (CostTypeEnum e : enumArray) {
                if (e.getCode() == code) {
                    return e.getDesc();
                }
            }
            return "";
        }
    }

    @Getter
    @AllArgsConstructor
    public enum BusinessCostTypeEnum {

        CHARGE_ELECTRICITY_COST(1, "电费"),
        CHARGE_SERVICE_COST(2, "服务费"),
        ;

        private final int code;
        private final String desc;

    }

    @Getter
    @AllArgsConstructor
    public enum RefundModeEnum {

        BACKTRACK(1, "原路返回"),
        CASH_PAYMENT(2, "现金支付"),
        OFFLINE_REFUND(9, "线下退款"),
        ;

        private final int code;
        private final String desc;

        public static String getDescByCode(Integer code) {
            if (Objects.isNull(code)) {
                return null;
            }
            RefundModeEnum[] enumArray = RefundModeEnum.values();
            for (RefundModeEnum e : enumArray) {
                if (e.getCode() == code) {
                    return e.getDesc();
                }
            }
            return "";
        }

    }

}
