package com.snack.server.module.order.enums;

import lombok.Getter;

/**
 * 支付渠道
 */
@Getter
public enum PayChannelEnum {

    ALIPAY("alipay", "支付宝"),
    WECHAT("wechat", "微信支付"),
    BALANCE("balance", "余额支付");

    private final String code;
    private final String desc;

    PayChannelEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PayChannelEnum of(String code) {
        if (code == null) return null;
        for (PayChannelEnum e : values()) {
            if (e.code.equalsIgnoreCase(code)) return e;
        }
        return null;
    }
}
