package com.yuchen.saas.message.api.feign.ws;

import com.yuchen.saas.message.api.dto.WebSocketMessagDTO;
import com.yuchen.saas.message.api.vo.NoticeVo;
import org.nest.springwrap.core.tool.api.R;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/11/16 11:40
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class WebSocketFeignFallback implements FallbackFactory<WebSocketFeignServer> {

    @Override
    public WebSocketFeignServer create(Throwable cause) {
        return new WebSocketFeignServer() {
            @Override
            public R<Boolean> convertAndSendToUser(WebSocketMessagDTO messagDTO) {
                return R.fail("远程调用失败");
            }

            @Override
            public R send(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R postConnect(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R postEvent(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R postFace(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R postVehicle(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R realTimeData(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R simulationData(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }

            @Override
            public R sendNotice(NoticeVo noticeVo) {
                return R.fail("远程调用失败");
            }
        };
    }
}