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

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.device.api.dto.DeviceOptionsDto;
import com.sptg.device.api.entity.DeviceOptions;
import com.sptg.device.api.feigns.DeviceOptionsFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class DeviceOptionsFeignFallbackFactory implements FallbackFactory<DeviceOptionsFeign> {
    @Override
    public DeviceOptionsFeign create(Throwable cause) {
        return new DeviceOptionsFeign() {
            @Override
            public Boolean add(DeviceOptionsDto deviceOptionsDto) {
                log.error(cause.getMessage());
                return false;
            }

            @Override
            public Boolean edit(DeviceOptionsDto deviceOptionsDto) {
                log.error(cause.getMessage());
                return false;
            }

            @Override
            public Boolean deleteOptions(DeviceOptionsDto deviceOptionsDto) {
                log.error(cause.getMessage());
                return false;
            }
            @Override
            public Boolean deleteByOptionsId(Long id) {
                log.error(cause.getMessage());
                return false;
            }

            @Override
            public DeviceOptions getBySerialNumber(String serialNumber) {
                log.error(cause.getMessage());
                return null;
            }

            @Override
            public DeviceOptions getByDeviceId(Long deviceId) {
                log.error(cause.getMessage());
                return null;
            }

            @Override
            public DeviceOptions getOne(DeviceOptionsDto deviceOptionsDto) {
                log.error(cause.getMessage());
                return null;
            }

        };
    }
}
