package com.yingpaipay.web.service.factory;

import com.yingpaipay.web.service.IAppletAuthService;
import org.dromara.common.core.exception.BusinessException;
import org.dromara.common.core.utils.MessageUtils;
import org.dromara.common.core.utils.SpringUtils;
import org.springframework.stereotype.Component;

/**
 * @Author: Huanyi
 * @CreateTime: 2025-12-04
 * @Description:
 * @Version: 1.0
 */

@Component
public class AppletAuthStrategyFactory {

    private static final String BASE_SERVICE = "AppletAuthService";

    public IAppletAuthService getInstance(String strategy) {
        String beanName = strategy + BASE_SERVICE;
        if (!SpringUtils.containsBean(beanName)) {
            throw new BusinessException(MessageUtils.message("applet.auth.nostrategy"));
        }
        return SpringUtils.getBean(beanName);
    }

}
