using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IpcLibrary.Core {
    /// <summary>
    /// IPC客户端接口
    /// </summary>
    public interface IIPCClient : IDisposable {
        string ProcessId { get; }
        bool IsConnected { get; }

        event EventHandler<ProcessInfo> ProcessConnected;
        event EventHandler<ProcessInfo> ProcessDisconnected;
        event EventHandler<IPCMessage> MessageReceived;

        Task<bool> ConnectAsync(string serverAddress);
        Task DisconnectAsync();
        Task<T> CallMethodAsync<T>(string targetProcessId, string serviceName, string methodName, params object[] parameters);
        Task<object> CallMethodAsync(string targetProcessId, string serviceName, string methodName, Type returnType, params object[] parameters);
        Task SendNotificationAsync(string targetProcessId, string method, params object[] parameters);
        Task RegisterServiceAsync<T>(string serviceName, T serviceInstance);
        Task UnregisterServiceAsync(string serviceName);
    }
}
