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

import com.yuchen.saas.device.api.dto.assets.AddAssetsMaintainReqDTO;
import com.yuchen.saas.device.api.dto.assets.client.AddInspectRepairDataDTO;
import com.yuchen.saas.device.api.utils.SaasDeviceFeignFallbackUtils;
import com.yuchen.saas.device.api.vo.assets.SaasAssetsDataInfoVO;
import feign.hystrix.FallbackFactory;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.stereotype.Component;

@Component
public class AssetsFeignFallback implements FallbackFactory<AssetsFeign> {


    @Override
    public AssetsFeign create(Throwable throwable) {
        return new AssetsFeign() {
            @Override
            public R<SaasAssetsDataInfoVO> getAssetsDataInfoById(Long id) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R addInspectRepairData(AddInspectRepairDataDTO reqDTO) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R addAssetsMaintainData(AddAssetsMaintainReqDTO reqDTO) {
                return SaasDeviceFeignFallbackUtils.printLogAndReturn(throwable);
            }
        };
    }
}
