import 'package:flux/core/enums_and_consts/enums.dart';
import 'package:get_it/get_it.dart';
import 'package:shared_preferences/shared_preferences.dart';

class AppSettings {
  late String _themeModeSetting;
  late SharedPreferences _prefs;

  // Singleton

  static final AppSettings _instance = AppSettings._internal();

  factory AppSettings() {
    return _instance;
  }

  AppSettings._internal() {
    _prefs = GetIt.I.get<SharedPreferences>();
    _themeModeSetting = _prefs.getString('theme') ?? 'light';
  }

  String get themeModeSetting => _themeModeSetting;

  void setThemeModeSetting(String value) {
    _themeModeSetting = value;
    _prefs.setString(PrefKeys.theme.value, value);
  }
}
