package com.develop.step.viewmodel

import android.app.Application
import android.content.res.Resources
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.MutableLiveData
import com.develop.food.base.data.ModesType
import com.develop.food.base.data.model.CookSettingType
import com.develop.step.R
import com.develop.step.model.CookStatus

class CookModesViewModel(application: Application) : AndroidViewModel(application) {
    val currentStep = MutableLiveData<CookSettingType>()
    val tempStatus = CookStatus.Temp(80)
    val timeStatus = CookStatus.Time(5, 0, 0)
    val speedStatus = CookStatus.Speed(2, 0)
    val directionStatus = CookStatus.Direction(1, 1)

    fun changeStep(step: CookSettingType) {
        currentStep.value = step
    }


    fun getBanner(modeType: String): Int {
        return when (modeType) {
            ModesType.CHOP.name -> {
                R.drawable.ic_mode_chop
            }
            ModesType.STEAM.name -> {
                R.drawable.ic_mode_steam
            }
            ModesType.FOOD_PROCESSOR.name -> {
                R.drawable.ic_mode_food_processor
            }
            ModesType.BOIL_WATER.name -> {
                R.drawable.ic_mode_boil_water
            }
            ModesType.ADAPTED_COOKING.name -> {
                R.drawable.ic_mode_diy
            }
            ModesType.WIGHT.name -> {
                R.drawable.ic_mode_weight
            }
            ModesType.SLOW_COOK.name -> {
                R.drawable.ic_mode_slow_cook
            }
            ModesType.KNEAD_TOUGH.name -> {
                R.drawable.ic_mode_knead_dough
            }
            ModesType.TURBO.name -> {
                R.drawable.ic_mode_turbo
            }
            else -> {
                R.drawable.ic_mode_chop
            }
        }
    }

    fun getModeTitle(resources: Resources, modeType: String): String {
        return when (modeType) {
            ModesType.CHOP.name -> {
                resources.getString(R.string.chop)
            }
            ModesType.STEAM.name -> {
                resources.getString(R.string.steam)
            }
            ModesType.FOOD_PROCESSOR.name -> {
                resources.getString(R.string.food_processor)
            }
            ModesType.BOIL_WATER.name -> {
                resources.getString(R.string.boil_water)
            }
            ModesType.ADAPTED_COOKING.name -> {
                resources.getString(R.string.adapted_cooking)
            }
            ModesType.WIGHT.name -> {
                resources.getString(R.string.wight)
            }
            ModesType.SLOW_COOK.name -> {
                resources.getString(R.string.slow_cook)
            }
            ModesType.KNEAD_TOUGH.name -> {
                resources.getString(R.string.knead_dough)
            }
            ModesType.TURBO.name -> {
                resources.getString(R.string.turbo)
            }
            else -> {
                resources.getString(R.string.adapted_cooking)
            }
        }
    }

}