using System.Text.Json;
using Photino.NET;

namespace BrikInstaller.Services;

public static class IPC {
    
    public static void sendRequirementCheckConsoleLog(PhotinoWindow window, string log) {
        sendToRenderer(window, "requirement::log", log);
    }

    public static void sendToRenderer(PhotinoWindow window, string requestId, object data) {
        var logMessage = new { 
            requestId,
            payload = new { message = data }
        };
        window.SendWebMessage(JsonSerializer.Serialize(logMessage, Constants._jsonOptions));
    }
}