using Castle.DynamicProxy;
using Hast.Common.Interfaces;
using Hast.Common.Services;
using Hast.Communication.Extensibility;
using Hast.Communication.Extensibility.Events;
using Hast.Layer;
using System;
namespace Hast.Communication;
///
/// Delegate for handling member invocations of objects whose logic is implemented as hardware.
///
/// The context of the member invocation.
public delegate void MemberInvocationHandler(IInvocation invocation);
///
/// Creates delegates that will handle member invocations issued to members of objects whose logic is implemented as
/// hardware.
///
public interface IMemberInvocationHandlerFactory : ISingletonDependency
{
///
/// Event that fires once the hardware execution has concluded.
///
event EventHandler> MemberExecutedOnHardware;
///
/// Event that fires before the hardware execution starts.
///
event EventHandler> MemberInvoking;
///
/// Creates a new instance of from the generated hardware representation.
///
/// The result of IHastlayer.GenerateHardwareAsync.
/// The object to be proxied.
/// Configuration for IHastlayer.GenerateProxyAsync.
MemberInvocationHandler CreateMemberInvocationHandler(
IHardwareRepresentation hardwareRepresentation,
object target,
IProxyGenerationConfiguration configuration);
}