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

import com.yuchen.saas.manage.user.api.entity.UserVehicleData;
import com.yuchen.saas.manage.user.api.request.dto.*;
import com.yuchen.saas.manage.user.api.util.SaasUserFeignFallbackUtils;
import com.yuchen.saas.manage.user.api.vo.*;
import com.yuchen.saas.manage.user.api.vo.user.IdCardOcrVO;
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;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;


/**
 * @Author 蔡文强
 * @Date 2023/5/6 15:56
 * @Description 用户车辆认证远程调用熔断
 */
@Component
public class UserVehicleCertificationFeignFallback implements FallbackFactory<UserVehicleCertificationFeign> {

    @Override
    public UserVehicleCertificationFeign create(Throwable throwable) {
        return new UserVehicleCertificationFeign() {

            @Override
            public R<VehicleLicenseOcrVO> discernVehicleLicenseOcr(VehicleLicenseOcrDTO ocrDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserVehicleCertificationResultVO> saveUserVehicleCertification(UserVehicleCertificationDTO userVehicleCertificationDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> updateUserVehicleCertification(UserVehicleCertificationChangeDTO changeDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserVehicleCertificationVO> getUserVehicleCertificationById(Long id) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<NestPage<UserVehicleCertificationVO>> getUserVehicleCertificationList(UserVehicleCertificationQueryDTO queryDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserPlateAuthenticationDetailVO> getUserPlateAuthenticationDetail(UserPlateAuthenticationReqDTO reqDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<UserVehicleData> getAuthenticationVehicleDataByPlateNo(String plateNo) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<IdCardOcrVO> discernIdCardOcr(IdCardOcrReqDTO reqDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }


            @Override
            public R<List<UserVehicleCertificationAppealHandingListVO>> getUserHandingList() {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

            @Override
            public R<Boolean> saveUserVehicleCertificationAppeal(UserVehicleCertificationAppealDTO userVehicleCertificationDTO) {
                return SaasUserFeignFallbackUtils.printLogAndReturn(throwable);
            }

        };
    }

}
