using FaceRecognition;
using ReAct_PME.WPF_FrameWork;
using Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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

        public ParametresFaceRecognition_VM()
        {
            LoadData();
        }

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


                return bReturn;

            }
            catch
            {
                return false;
            }

        }

        public bool SaveData()
        {
            try
            {
                SelectedItem.Path_TrainSet = SelectedItem.Path_TrainSet.Trim();
                SelectedItem.Path_TestSet = SelectedItem.Path_TestSet.Trim();

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

        }
    }
}
