using Dalamud.Interface.ImGuiNotification;
using HellionChat.Resources;

namespace HellionChat.Util;

public static class WrapperUtil
{
    public static void AddNotification(string content, NotificationType type, bool minimized = true)
    {
        Plugin.Notification.AddNotification(
            new Notification
            {
                Content = content,
                Type = type,
                Minimized = minimized,
            }
        );
    }

    public static void TryOpenUri(Uri uri)
    {
        try
        {
            Plugin.LogProxy.Debug($"Opening URI {uri} in default browser");
            Plugin.PlatformUtil.OpenLink(uri.ToString());
        }
        catch (Exception ex)
        {
            Plugin.LogProxy.Error($"Error opening URI: {ex}");
            AddNotification(Language.Context_OpenInBrowserError, NotificationType.Error);
        }
    }
}
