using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;

namespace Arkadium.Interop
{
    /// <summary>
    /// Provides a cleaner interface for WebGL interop with promise-based results
    /// </summary>
    public static class WebGLInterop
    {
        /// <summary>
        /// Invokes a JavaScript method and returns a promise-like result
        /// </summary>
        public static async Task<T> InvokeAsync<T>(string methodName, object parameters = null)
        {
            return await WebGLInteropFactory.GetProvider().InvokeAsync<T>(methodName, parameters);
        }

        /// <summary>
        /// Invokes a JavaScript method without expecting a return value
        /// </summary>
        public static void InvokeVoid(string methodName, object parameters = null)
        {
            WebGLInteropFactory.GetProvider().InvokeVoid(methodName, parameters);
        }
    }
}