package com.yuchen.saas.manage.user.api.feign;

import com.yuchen.saas.manage.user.api.entity.SaasWechatSubscribeData;
import com.yuchen.saas.manage.user.api.util.SaasUserFeignFallbackUtils;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @author zhouhanwei
 * @create 2024/1/2 16:19
 */
@Component
public class SaasWechatSubscribeDataClientFallback implements FallbackFactory<ISaasWechatSubscribeDataClient> {

    @Override
    public ISaasWechatSubscribeDataClient create(Throwable throwable) {

        return new ISaasWechatSubscribeDataClient() {

            @Override
            public R saveSubscribeData(SaasWechatSubscribeData subscribeData) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R updateUnSubscribeData(SaasWechatSubscribeData subscribeData) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<SaasWechatSubscribeData> getWechatSubscribeDataByOpenId(String openId) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<SaasWechatSubscribeData> getSubscribeDataByUnionIdAndAppId(String unionId, String appId) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
