package com.yida.data.server.fallback;

import com.yida.data.common.core.annotation.Fallback;
import com.yida.data.common.core.common.ResultBean;
import com.yida.data.server.dto.DisturbDTO;
import com.yida.data.server.dto.WhiteListDTO;
import com.yida.data.server.feign.RemoteCardOperationService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;

/**
 * RemoteCardOperationService fallback处理类
 *
 * @author ZYJ
 * @date 2022/8/26
 */
@Slf4j
@Fallback
public class RemoteCardOperationServiceFallback implements FallbackFactory<RemoteCardOperationService> {

    @Override
    public RemoteCardOperationService create(Throwable throwable) {
        log.error("RemoteCardOperationService fallback reason:{}", throwable.getMessage());

        return new RemoteCardOperationService() {
            /**
             * 更新白名单
             *
             * @param dto
             * @return
             */
            @Override
            public ResultBean whiteList(WhiteListDTO dto) {
                return null;
            }

            /**
             * 更新免打扰设置
             *
             * @param dto
             * @return
             */
            @Override
            public ResultBean disturbTime(DisturbDTO dto) {
                return null;
            }

            /**
             * 立即定位
             *
             * @param imei
             * @return
             */
            @Override
            public ResultBean nowLocation(String imei) {
                return null;
            }
        };
    }
}
