package cn.novalon.gym.manage.sys.config;

import cn.novalon.gym.manage.sys.security.JwtAuthenticationFilter;
import cn.novalon.gym.manage.sys.security.JwtTokenProvider;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

import static org.mockito.Mockito.mock;

/**
 * 集成测试配置类
 * 
 * 为@SpringBootTest提供必要的Spring Boot配置
 * 
 * @author 张翔
 * @date 2026-04-02
 */
@SpringBootConfiguration
@EnableAutoConfiguration
public class IntegrationTestConfig {

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder(12);
    }

    @Bean
    public JwtTokenProvider jwtTokenProvider() {
        return mock(JwtTokenProvider.class);
    }

    @Bean
    public JwtAuthenticationFilter jwtAuthenticationFilter() {
        return new JwtAuthenticationFilter(jwtTokenProvider());
    }
}
