using ReAct_PME.WPF_FrameWork;
using Services;

namespace ReAct_PME.ViewModels
{
    public class ParametresRAG_VM : BaseViewModel
    {
        public ParametresRAGService SelectedItem { get; set; } = new();

        public ParametresRAG_VM()
        {
            LoadData();
        }

        private bool LoadData()
        {
            bool bReturn = false;
            try
            {
                var item = RAGService.LoadParametres();
                if (item != null)
                {
                    SelectedItem = (ParametresRAGService)item;
                    bReturn = true;
                }


                return bReturn;

            }
            catch
            {
                return false;
            }

        }

        public bool SaveData()
        {
            try
            {
                SelectedItem.RAG_Path_ToVectoralize = SelectedItem.RAG_Path_ToVectoralize.Trim();
                SelectedItem.RAG_Path_Vectoralized = SelectedItem.RAG_Path_Vectoralized.Trim();

                return RAGService.SaveParametres(SelectedItem);
            }
            catch
            {
                return false;
            }

        }

    }
}
