using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace TodoList.Maui.Models
{
    /// <summary>
    /// 热键配置模型类
    /// </summary>
    public class HotKeyConfig : INotifyPropertyChanged
    {
        private string _modifiers = "Alt";
        private string _key = "X";
        private bool _isEnabled = true;

        /// <summary>
        /// 修饰键（如 Alt, Control, Shift 等）
        /// </summary>
        public string Modifiers
        {
            get => _modifiers;
            set
            {
                if (_modifiers != value)
                {
                    _modifiers = value;
                    OnPropertyChanged();
                }
            }
        }

        /// <summary>
        /// 主键（如 X, C, V 等）
        /// </summary>
        public string Key
        {
            get => _key;
            set
            {
                if (_key != value)
                {
                    _key = value;
                    OnPropertyChanged();
                }
            }
        }

        /// <summary>
        /// 是否启用热键
        /// </summary>
        public bool IsEnabled
        {
            get => _isEnabled;
            set
            {
                if (_isEnabled != value)
                {
                    _isEnabled = value;
                    OnPropertyChanged();
                }
            }
        }

        public event PropertyChangedEventHandler? PropertyChanged;

        protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}