package com.yuchen.saas.device.api.feign;

import com.yuchen.saas.device.api.dto.NetOperateDeviceQueryDto;
import com.yuchen.saas.device.api.dto.operatingEnd.NetDevicePageQryDTO;
import com.yuchen.saas.device.api.utils.SaasDeviceFeignFallbackUtils;
import com.yuchen.saas.device.api.vo.NetOperateDeviceListVO;
import com.yuchen.saas.device.api.vo.operatingEnd.NetOperateDevicePageVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.mp.support.NestPage;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

/**
 * @Author yuanzhelin
 * @Date 2024/7/30 17:22
 * @Description TODO
 */
@Component
public class NetOperateDeviceFeignServiceFallback implements FallbackFactory<NetOperateDeviceFeignService>{
    @Override
    public NetOperateDeviceFeignService create(Throwable throwable) {
        return new NetOperateDeviceFeignService() {
            @Override
            public R<NetOperateDevicePageVO> getData(Long deviceId) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NestPage<NetOperateDeviceListVO>> getNoBoundList(String deviceIds) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NetOperateDeviceListVO> getOne(NetOperateDeviceQueryDto dto) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NestPage<NetOperateDevicePageVO>> page(NetDevicePageQryDTO qryDto) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
