using FluentValidation.Results;
using System.Threading;
using System.Threading.Tasks;
namespace Kean.Domain
{
///
/// 表示命令总线
///
public interface ICommandBus
{
///
/// 执行命令
///
/// 命令模型
/// 取消标记
Task Execute(ICommand command, CancellationToken cancellationToken = default);
///
/// 触发事件
///
/// 事件模型
/// 取消标记
Task Trigger(IEvent @event, CancellationToken cancellationToken = default);
///
/// 发送通知
///
/// 属性名
/// 消息内容
/// 属性值
/// 消息码
/// 取消标记
Task Notify(string propertyName, string errorMessage = default, object attemptedValue = default, object errorCode = default, CancellationToken cancellationToken = default);
///
/// 发送通知
///
/// 验证结果
/// 取消标记
Task Notify(ValidationResult validationResult, CancellationToken cancellationToken = default);
}
}