using TodoList.Maui.Services.Platforms;

namespace TodoList.Maui.Services
{
    /// <summary>
    /// 全局热键服务工厂类，根据平台创建相应的热键服务实例
    /// </summary>
    public static class GlobalHotKeyServiceFactory
    {
        /// <summary>
        /// 创建适合当前平台的全局热键服务实例
        /// </summary>
        /// <returns>全局热键服务实例</returns>
        public static IGlobalHotKeyService Create()
        {
#if WINDOWS
            return new WindowsGlobalHotKeyService();
#elif MACCATALYST
            return new MacGlobalHotKeyService();
#elif ANDROID || IOS
            return new MobileGlobalHotKeyService();
#else
            return new NullGlobalHotKeyService();
#endif
        }
    }

    /// <summary>
    /// 空热键服务实现类，用于不支持热键的平台
    /// </summary>
    public class NullGlobalHotKeyService : IGlobalHotKeyService
    {
        /// <summary>
        /// 不支持热键
        /// </summary>
        public bool IsSupported => false;

        /// <summary>
        /// 注册热键（空实现）
        /// </summary>
        public void RegisterHotKey(string modifiers, string key, Action callback)
        {
        }

        /// <summary>
        /// 注销热键（空实现）
        /// </summary>
        public void UnregisterHotKey()
        {
        }

        /// <summary>
        /// 更新热键（空实现）
        /// </summary>
        public void UpdateHotKey(string modifiers, string key)
        {
        }
    }
}