package com.omixlab.lckcontrol.data.local

import android.content.Context
import android.content.SharedPreferences
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class AppPreferences @Inject constructor(
    @ApplicationContext context: Context,
) {
    private val prefs: SharedPreferences =
        context.getSharedPreferences("lck_control_app_prefs", Context.MODE_PRIVATE)

    fun getDefaultExecutionMode(): String =
        prefs.getString(KEY_DEFAULT_EXECUTION_MODE, "IN_GAME") ?: "IN_GAME"

    fun setDefaultExecutionMode(mode: String) {
        prefs.edit().putString(KEY_DEFAULT_EXECUTION_MODE, mode).apply()
    }

    private companion object {
        const val KEY_DEFAULT_EXECUTION_MODE = "default_execution_mode"
    }
}
