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

import lombok.Getter;

/**
 * 支付通知类型枚举
 */
@Getter
public enum PayNotifyTypeEnum {

    /**
     * 商城支付成功通知
     */
    MALL_PAY_SUCCESS(1, "商城支付成功通知"),

    /**
     * 商城支付失败通知
     */
    MALL_PAY_FAIL(2, "商城支付失败通知"),

    /**
     * 商城退款成功通知
     */
    MALL_REFUND_SUCCESS(3, "商城退款成功通知"),

    /**
     * 商城退款失败通知
     */
    MALL_REFUND_FAIL(4, "商城退款失败通知"),

    /**
     * 学豆充值成功通知
     */
    COIN_RECHARGE_SUCCESS(5, "学豆充值成功通知"),

    /**
     * 学豆充值失败通知
     */
    COIN_RECHARGE_FAIL(6, "学豆充值失败通知"),

    /**
     * 学豆退款成功通知
     */
    COIN_REFUND_SUCCESS(7, "学豆退款成功通知"),

    /**
     * 学豆退款失败通知
     */
    COIN_REFUND_FAIL(8, "学豆退款失败通知");

    private final Integer code;
    private final String description;

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

    /**
     * 根据code获取枚举
     */
    public static PayNotifyTypeEnum fromCode(Integer code) {
        for (PayNotifyTypeEnum type : PayNotifyTypeEnum.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}