package com.vctgo.system.api.factory;

import com.vctgo.common.core.domain.R;
import com.vctgo.system.api.RemoteTagService;
import com.vctgo.system.api.domain.SysTagManagement;
import com.vctgo.system.api.domain.dto.SysTagManagementDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 部门服务降级处理
 *
 * @author vctgo
 */
@Component
public class RemoteTagFallbackFactory implements FallbackFactory<RemoteTagService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteTagFallbackFactory.class);

    @Override
    public RemoteTagService create(Throwable throwable) {
        log.error("获取部门服务调用失败:{}", throwable.getMessage());
        return new RemoteTagService(){

//            @Override
//            public R<List<SysTagManagement>> pageList(SysTagManagement sysTagManagement) {
//                return R.fail("获取标签失败:" + throwable.getMessage());
//            }

            @Override
            public R<List<SysTagManagement>> listAll(SysTagManagementDto sysTagManagementDto) {
                return R.fail("获取标签失败:" + throwable.getMessage());
            }

//            @Override
//            public R<SysTagManagement> addTag(SysTagManagement sysTagManagement) {
//                return R.fail("添加标签失败:" + throwable.getMessage());
//            }
//
//            @Override
//            public R<SysTagManagement> editTag(SysTagManagement sysTagManagement) {
//                return R.fail("编辑标签失败:" + throwable.getMessage());
//            }
//
//            @Override
//            public R<SysTagManagement> changeTagStatus(SysTagManagement sysTagManagement) {
//                return R.fail("标签状态开启/关闭失败:" + throwable.getMessage());
//            }

//            @Override
//            public R<Integer> abandon(Long[] ids) {
//                return R.fail("删除标签失败:" + throwable.getMessage());
//            }
        };
    }
}
