package com.jeesharp.business.modules.pay.paywechatconfig.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * C 端微信 JSAPI 预下单路由类型，与具体微信 API 路径一一对应。
 *
 * @author jeesharp
 * @since 2026-06-12
 */
@Getter
@AllArgsConstructor
public enum WechatPayRouteTypeEnum {

    DIRECT("DIRECT", "境内直连 jsapi"),
    PARTNER("PARTNER", "partner jsapi 单商户"),
    COMBINE("COMBINE", "合单 jsapi 多商户");

    private final String value;

    private final String desc;

    public static WechatPayRouteTypeEnum fromValue(String value) {
        if (value == null || value.isBlank()) {
            return null;
        }
        for (WechatPayRouteTypeEnum item : values()) {
            if (item.getValue().equalsIgnoreCase(value.trim())) {
                return item;
            }
        }
        return null;
    }
}
