package org.springblade.system.client.factory;

import lombok.extern.slf4j.Slf4j;
import org.springblade.system.client.TenantClient;
import org.springblade.system.client.model.TenantModel;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author hepingguo
 * @version 1.0
 * @description: TODO
 * @date 2023/11/25 12:02
 */
@Component
@Slf4j
public class TenantClientFallbackFactory implements FallbackFactory<TenantClient> {
    @Override
    public TenantClient create(Throwable cause) {
        log.error("UserClient invoke fallback:{}", cause.getMessage());

        return new TenantClient() {
            @Override
            public List<TenantModel> getTenantList(String tenantId) {
                return null;
            }

            @Override
            public List<TenantModel> getTenantByTenantIds(List<String> tenantIds) {
                return null;
            }
        };
    }
}
