package com.yuchen.saas.park.api.feign.service;

import com.yuchen.saas.park.api.dto.park.IoTEvent;
import com.yuchen.saas.park.api.entity.fault.ConnectEvent;
import com.yuchen.saas.park.api.vo.fault.DeviceProperty;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @Author: 肖润飞
 * @CreateTime: 2022/11/15 16:19
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class DeviceInputFeignServiceFallback implements FallbackFactory<DeviceInputFeignService> {

    @Override
    public DeviceInputFeignService create(Throwable cause) {

        return new DeviceInputFeignService() {
            @Override
            public R deviceConnectInput(ConnectEvent connectEvent) {
                return R.fail("feign远程调用失败");
            }

            @Override
            public R deviceEventInput(IoTEvent ioTEvent) {
                return R.fail("feign远程调用失败");
            }

            @Override
            public R devicePropertyInput(DeviceProperty deviceProperty) {
                return R.fail("feign远程调用失败");
            }

            @Override
            public R receiveIotDoorEventInfo(String deviceProperty) {
                return R.fail("feign远程调用失败");
            }

        };
    }
}