//package kr.lunaticbum.back.lun.configs
//
//import lombok.RequiredArgsConstructor
//import lombok.extern.slf4j.Slf4j
//import org.springframework.batch.core.Job
//import org.springframework.batch.core.Step
//import org.springframework.batch.core.StepContribution
//import org.springframework.batch.core.configuration.DuplicateJobException
//import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing
//import org.springframework.batch.core.configuration.support.DefaultBatchConfiguration
//import org.springframework.batch.core.job.builder.JobBuilder
//import org.springframework.batch.core.repository.JobRepository
//import org.springframework.batch.core.scope.context.ChunkContext
//import org.springframework.batch.core.step.builder.StepBuilder
//import org.springframework.batch.core.step.tasklet.Tasklet
//import org.springframework.batch.repeat.RepeatStatus
//import org.springframework.context.annotation.Bean
//import org.springframework.context.annotation.Configuration
//import org.springframework.transaction.PlatformTransactionManager
//import org.springframework.web.reactive.function.client.WebClient
//
//
//@Configuration
//@RequiredArgsConstructor
//class BatchConfig : DefaultBatchConfiguration() {
//
//    @Bean
//    @Throws(DuplicateJobException::class)
//    fun testJob(jobRepository: JobRepository, transactionManager: PlatformTransactionManager?): Job {
//        val job: Job = JobBuilder("testJob", jobRepository!!)
//            .start(testStep(jobRepository, transactionManager))
//            .build()
//        return job
//    }
//
//    fun testStep(jobRepository: JobRepository?, transactionManager: PlatformTransactionManager?): Step {
//        val step: Step = StepBuilder("testStep", jobRepository!!)
//            .tasklet(testTasklet(), transactionManager!!)
//            .build()
//        return step
//    }
//
//    fun testTasklet(): Tasklet {
//        return (Tasklet { contribution: StepContribution?, chunkContext: ChunkContext? ->
//            println("***** hello batch! *****")
//            val client0 = WebClient.create()
//            val result = client0.get()
//                .uri("http://api.weatherapi.com/v1/current.json?key=de574a260b1f474d99955729241909&q=seoul&aqi=no")
//                .retrieve()
//                .bodyToMono(String::class.java).block() ?: "FAIL"
//
//
//            val client = WebClient.create()
//            client.get()
//                .uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=${result}")
//                .retrieve()
//                .bodyToMono(String::class.java).block() ?: "FAIL"
//
//            RepeatStatus.FINISHED
//        })
//    }
//}