using System;
using GFramework.Core.Abstractions.command;
using GFramework.Core.Abstractions.events;
using GFramework.Core.Abstractions.query;
namespace GFramework.Core.Abstractions.architecture;
///
/// 架构运行时接口,提供统一的命令、查询、事件操作入口
/// 负责委托 ArchitectureContext 的能力执行具体操作
///
public interface IArchitectureRuntime
{
///
/// 发送并执行指定的命令
///
/// 命令类型,必须实现ICommand接口
/// 要执行的命令实例
void SendCommand(T command) where T : ICommand;
///
/// 发送并执行带有返回值的命令
///
/// 命令执行结果的类型
/// 要执行的命令实例
/// 命令执行的结果
TResult SendCommand(ICommand command);
///
/// 发送并执行查询操作
///
/// 查询结果的类型
/// 要执行的查询实例
/// 查询的结果
TResult SendQuery(IQuery query);
///
/// 发送无参事件
///
/// 事件类型,必须具有无参构造函数
void SendEvent() where TEvent : new();
///
/// 发送指定的事件实例
///
/// 事件类型
/// 要发送的事件实例
void SendEvent(TEvent e) where TEvent : class;
///
/// 注册事件监听器
///
/// 事件类型
/// 事件触发时的回调方法
/// 用于取消注册的句柄
IUnRegister RegisterEvent(Action onEvent);
///
/// 取消注册事件监听器
///
/// 事件类型
/// 要取消注册的事件回调方法
void UnRegisterEvent(Action onEvent);
}