namespace EventBus
{
    /// <summary>
    /// 事件句柄
    /// </summary>
    /// <typeparam name="TData">事件发布数据类型</typeparam>
    /// <typeparam name="T">事件返回数据类型</typeparam>
    public interface IEventData<TData, T> : IBaseEventData
    {
        /// <summary>
        /// 发布同步事件
        /// <para>
        /// 当存在多个订阅时，只返回第一个订阅结果
        /// </para></summary>
        /// <param name="sender">事件源</param>
        /// <param name="data">事件数据</param>
        /// <param name="properties">筛选器</param>
        /// <returns></returns>
        T Publish(object sender, TData data, Properties? properties = null);
        /// <summary>
        /// 发布异步事件
        /// </summary>
        Task<T> PublishAsync(object sender, TData data, Properties? properties = null);
        List<T> PublishList(object sender, TData data, Properties? properties = null);
        Task<List<T>> PublishListAsync(object sender, TData data, Properties? properties = null);
        /// <summary>
        /// 订阅事件
        /// </summary>
        /// <param name="func">事件处理函数</param>
        /// <param name="properties">筛选器</param>
        Guid Subscrip(Func<object, EventArgs<TData>, T> func, Properties? properties = null);
        /// <summary>
        /// 订阅事件
        /// </summary>
        /// <param name="func">事件处理函数</param>
        /// <param name="properties">筛选器</param>
        Guid SubscripList(Func<object, EventArgs<TData>, List<T>> func, Properties? properties = null);

    }
}