using System.Threading.Tasks;

namespace AIRuntime.Runtime.Capabilities
{
    /// <summary>
    /// Represents a middleware component in the capability
    /// execution pipeline.
    ///
    /// Middleware may perform work before and/or after the next
    /// middleware executes.
    /// </summary>
    public interface ICapabilityMiddleware
    {
        /// <summary>
        /// Executes this middleware.
        /// </summary>
        /// <param name="context">
        /// Current capability execution context.
        /// </param>
        /// <param name="next">
        /// Delegate used to invoke the next middleware in the
        /// pipeline.
        /// </param>
        Task InvokeAsync(
            CapabilityContext context,
            CapabilityDelegate next);
    }
}