using ReAct_PME.WPF_FrameWork;
using ToolsServices;

namespace ReAct_PME.ViewModels
{
    public class ParametresLogs_VM : BaseViewModel
    {
        public int SelectedItem { get; set; }

        public ParametresLogs_VM()
        {
            LoadData();
        }

        private bool LoadData()
        {
            bool bReturn = false;
            try
            {
                SelectedItem = LoggerService.LoadParametres();
                return bReturn;

            }
            catch
            {
                return false;
            }

        }

        public bool SaveData()
        {
            try
            {
                if(SelectedItem<0 || SelectedItem > 3)
                {
                    SelectedItem = 0; // Réinitialiser à 0 si la valeur est en dehors de l'intervalle
                    return false;
                }
                return LoggerService.SaveParametres(SelectedItem);
            }
            catch
            {
                return false;
            }

        }
    }
}
