package kr.lunaticbum.back.lun.configs

import io.qdrant.client.QdrantClient
import org.springframework.ai.ollama.api.OllamaApi
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer


@Configuration
class AppConfig : WebMvcConfigurer {
    @Value("\${resource.handler}")
    private val resourceHandler: String? = null

    @Value("\${resource.location}")
    private val resourceLocation: String? = null

    @Bean
    fun authInterceptor(): BumsInterceptor {
        return BumsInterceptor()
    }
    override fun addResourceHandlers(registry: org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry) {
        registry.addResourceHandler(resourceHandler).addResourceLocations(resourceLocation)
    }

    override fun addInterceptors(registry: InterceptorRegistry) {
        registry.addInterceptor(authInterceptor())
        super.addInterceptors(registry)
    }


//    @Bean
//    fun qdrantClient(): QdrantClient {
//        return QdrantClient("https://ollama.lunaticbum.kr:6334")
//    }

//    @Bean
//    fun chatClient(): OllamaApi {
//        return OllamaApi("https://lama.lunaticbum.kr")
//
////            .withDefaultOptions(
////                OllamaOptions.create()
////                    .withModel("phi4:14b")
////                    .withNumThread(5)
////                    .withSeed(5)
////                    .withTemperature(0.9f))
//    }
//    @Bean
//    fun getProperty()  : Map<String,String>{
//        println("telegramBotKey >>>> $telegramBotKey")
//        println("telegramMyId >>>> $telegramMyId")
//        println("weatherApiKey >>>> $weatherApiKey")
//
//        return hashMapOf(Pair("telegramMyId",telegramMyId))
//    }
//    @Bean
//    fun memberRepository(): MemberRepository {
//        return MemoryMemberRepository()
//    }
//
//    @Bean
//    fun discountPolicy(): DiscountPolicy {
//        return RateDiscountPolicy()
//    }
//
//    @Bean
//    fun memberService(): MemberService {
//        return MemberServiceImpl(memberRepository())
//    }
//
//    @Bean
//    fun orderService(): OrderService {
//        return OrderServiceImpl(memberRepository(), discountPolicy())
//    }

}