package com.sptg.estate.api.feigns.fallback;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.estate.api.entity.VideoCallAccount;
import com.sptg.estate.api.feigns.VideoCallAccountFeign;
import com.sptg.permissions.api.entity.DeviceAdminUser;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * title: VideoCallAccountFeignFallbackFactory
 * description:
 *
 *                  
 *            
 */
@Component
@Slf4j
public class VideoCallAccountFeignFallbackFactory implements FallbackFactory<VideoCallAccountFeign> {


    @Override
    public VideoCallAccountFeign create(Throwable cause) {
        return new VideoCallAccountFeign(){
            @Override
            public void addEntityByUser(VideoCallAccount account) {
                log.error(cause.getMessage());
            }

            @Override
            public void addEntityByDevice(VideoCallAccount account) {
                log.error(cause.getMessage());
            }

            @Override
            public void addEntityByAdminUser(DeviceAdminUser user) {
                log.error(cause.getMessage());
            }

            @Override
            public ResultBean<Object> getRoomCallGroupId(VideoCallAccount account) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Object> getManageCallGroupId(VideoCallAccount account) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

            @Override
            public ResultBean<Object> getCallAccountIdBySerialNumber(VideoCallAccount account) {
                log.error(cause.getMessage());
                return new ResultBean<>(ResultEnum.ERROR);
            }

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

            @Override
            public VideoCallAccount getCallAccountByUser(Long userId) {
                log.error(cause.getMessage());
                return null;
            }
        };
    }
}
