using System.Data;
using Configuration;
using Microsoft.Data.SqlClient;
using Models;

namespace Services
{
    public interface IErrorService
    {
        Exception? ex { get; set; }
        event Action? OnChange;
    }

    public class ErrorService : IErrorService
    {
        private Exception? _ex;
        public Exception? ex
        {
            get => _ex;
            set
            {
                _ex = value;
                NotifyStateChanged();
            }
        }

        public event Action? OnChange;
        private void NotifyStateChanged() => OnChange?.Invoke();
    }
}