package com.seer.teach.common.enums.pay;

import lombok.Getter;

/**
 * 退款类型枚举
 */
@Getter
public enum RefundTypeEnum {

    /**
     * 售后退款
     */
    AFTER_SALE(1, "售后退款"),

    /**
     * 订单取消退款
     */
    ORDER_CANCEL(2, "订单取消退款"),

    /**
     * 学豆充值退款
     */
    COIN_RECHARGE(3, "学豆充值退款");

    private final Integer code;
    private final String description;

    RefundTypeEnum(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    /**
     * 根据code获取枚举
     * @param code 退款类型编码
     * @return 退款类型枚举
     */
    public static RefundTypeEnum fromCode(Integer code) {
        for (RefundTypeEnum type : RefundTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}