package kr.lunaticbum.back.lun.configs

import org.springframework.beans.factory.annotation.Value
import org.springframework.context.EnvironmentAware
import org.springframework.core.env.Environment
import org.springframework.stereotype.Component

@Component
class GlobalEnvironment : EnvironmentAware {
    companion object {
        val EncTypeKey = "enc"
        val EncType00 = "T0"
        val EncType11 = "T3"
        val EncType10 = "T2"
        val EncType01 = "T1"
        val ApiKeyWordKey = "keyword"
        private val pad = "%7C%2A-%2A%7C"
        fun padding(key : String) = pad.plus(key).plus(pad)
    }
    @Value("\${telegram.bot.key}")
    lateinit var telegramBotKey: String

    @Value("\${telegram.my.id}")
    lateinit var telegramMyId: String

    @Value("\${telegram.target.id}")
    lateinit var telegramTargetId: String

    @Value("\${weather.api.key}")
    lateinit var weatherApiKey: String

    @Value("\${api.gg.place}")
    lateinit var gapiKey: String

//    @Value("jwt.access-secret")
    var ACCESS_SECRET_KEY: String = "l00u00n00a00t00i00c00b00u00m00a00c00sk"
//    @Value("jwt.refresh-secret")
    var REFRESH_SECRET_KEY: String = "l00u00n00a00t00i00c00b00u00m00r00f00sk"
//    @Value("jwt.access-expiration")
    var ACCESS_EXPIRATION: Long = 60 * 5 * 1000L
//    @Value("jwt.refresh-expiration")
    var REFRESH_EXPIRATION: Long = 60 * 30 * 1000L

    override fun setEnvironment(environment: Environment) {
        environment.activeProfiles.forEach { println(it) }
        println ("telegramBotKey $telegramBotKey")
        println("telegramMyId $telegramMyId")
        println("telegramMyId $telegramTargetId")
        println("weatherApiKey $weatherApiKey")
    }

}