package com.sptg.third.api.feigns.grid.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.third.api.feigns.grid.GridVideoCloudFeign;
import com.sptg.video.cloud.api.entity.VCAccount;
import com.sptg.video.cloud.api.entity.VCDevice;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author zwx
 * @create 2020/11/28 20:19
 */
@Slf4j
@Component
public class GridVideoCloudFeignFallbackFactory implements FallbackFactory<GridVideoCloudFeign> {
    @Override
    public GridVideoCloudFeign create(Throwable cause) {
        return new GridVideoCloudFeign() {

            @Override
            public ResultBean<String> gridVideoCloudAccountIncrementPush() {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<String> gridVideoCloudAccountTotalPush() {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<String> gridVideoCloudDeviceIncrementPush() {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<String> gridVideoCloudDeviceTotalPush() {
                log.error(cause.getMessage(), cause);
                return new ResultBean<>(ResultEnum.ERROR);
            }
        };
    }
}
