package rowedto.jockeyedto.sheetedto.raceedto.pavementedto

import rowedto.jockeyedto.sheetedto.atticedto.equipmentedto.exactedto.costumeedto.Mythedto
import rowedto.jockeyedto.sheetedto.debutedto.revolutionaryedto.Dynamicedto

object Abridgeedto {
    private val functionCopyMap: HashMap<Int, ArrayList<String>> = hashMapOf()
    private var currentIndexMap: HashMap<Int, Int> = hashMapOf()

    private fun getCopyList(actionId: Int): ArrayList<String> {

        if (functionCopyMap[actionId] == null) {
            functionCopyMap[actionId] = arrayListOf()
        }
        val list = functionCopyMap[actionId] ?: arrayListOf()
        when (actionId) {
            Dynamicedto.ID_WEATHER ->{
                val city = Mythedto.getWeatherEntity()?.city ?: ""
                list.add("Sunny skies for many, but rain or snow for some over the next few days. How about ${city}? Tap to check!")
                list.add("Sunshine for many, but rain or snow forecast for some in the next few days. What’s ${city}’s forecast? Tap to find out!")
                list.add("Sunny days for many, but rain or snow for some in the next few days. What’s ${city} like? Tap to check!")
                list.add("Sun for many, but rain or snow for some in the next few days. How about ${city}? Tap to discover!")
            }
        }
        return list
    }

    fun getNextCopy(actionId: Int): String {

        val currentIndex = currentIndexMap[actionId] ?: 0
        val copyList = getCopyList(actionId)
        val copy = copyList[currentIndex]
        currentIndexMap[actionId] = (currentIndex + 1) % copyList.size
        return copy
    }
}