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

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author zhouhanwei
 * @create 2024/1/9 16:28
 */
@Getter
@AllArgsConstructor
public enum OrderTypeEnum {

    PARKING_FEE_TYPE(1, "临停缴费", "停车费退款"),
    MONTH_CARD_FEE_TYPE(2, "月卡充值缴费", "月卡退款"),
    TIMING_CARD_FEE_TYPE(20, "错时卡充值缴费", "错时卡退款"),
    CHARGE_FEE_TYPE(26, "充电缴费", "充电费退款"),
    WALLET_PAY_FEE_TYPE(28, "钱包充值", "钱包退款"),
    OCCUPY_FEE_TYPE(30, "占用费缴费", "占用费退款"),
    TENEMENT_FEE_TYPE(40, "物业费缴费", "物业费退款"),
    ;

    private final Integer code;
    private final String payDesc;
    private final String refundDesc;


    public static String getEnumPayDesc(Integer code) {
        if (Objects.nonNull(code)) {
            for (OrderTypeEnum e : OrderTypeEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e.getPayDesc();
                }
            }
        }
        return null;
    }

    public static String getEnumRefundDesc(Integer code) {
        if (Objects.nonNull(code)) {
            for (OrderTypeEnum e : OrderTypeEnum.values()) {
                if (e.getCode().equals(code)) {
                    return e.getRefundDesc();
                }
            }
        }
        return null;
    }
}
