package com.xindazhou.business.framework.rpc.config;

import com.xindazhou.business.api.config.ConfigApi;
import com.xindazhou.business.api.file.FileApi;
import com.xindazhou.business.api.member.MemberGroupApi;
import com.xindazhou.business.api.member.MemberLevelApi;
import com.xindazhou.business.api.member.MemberTagApi;
import com.xindazhou.business.api.member.MemberUserApi;
import com.xindazhou.business.api.websocket.WebSocketSenderApi;
import com.xindazhou.framework.common.biz.system.oauth2.OAuth2TokenCommonApi;
import com.xindazhou.framework.security.core.rpc.LoginUserRequestInterceptor;
import com.xindazhou.message.api.MessageSendApi;
import com.xindazhou.vehicle.api.VehicleApi;
import com.xindazhou.vehicle.api.VehicleAlarmApi;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(value = "systemRpcConfiguration", proxyBeanMethods = false)
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, ConfigApi.class, 
        MemberTagApi.class, MemberLevelApi.class, MemberGroupApi.class, MemberUserApi.class,
        com.xindazhou.user.api.user.MemberUserApi.class, OAuth2TokenCommonApi.class, VehicleApi.class, VehicleAlarmApi.class, MessageSendApi.class}) // 添加车辆和消息服务的 Feign 客户端
public class RpcConfiguration {

    /**
     * LoginUser 请求拦截器
     * 用于在 Feign 调用时传递用户信息到目标服务
     */
    @Bean
    public LoginUserRequestInterceptor loginUserRequestInterceptor() {
        return new LoginUserRequestInterceptor();
    }

    // ServiceJwtRequestInterceptor 已由 ServiceJwtAutoConfiguration 自动配置，无需手动注册
}
