using GB5Shared.ActionProcessor; using System.Threading; using System.Threading.Tasks; namespace FrameworkBLL.ActionProcessor.Handlers { /// /// Defines a contract for executing an action based on ActionType. /// Each implementation handles a specific action type /// (Email, SMS, Webhook, Notification, Report, etc.). /// /// Implementations are typically registered in Dependency Injection /// as Singleton services. /// public interface IActionHandler { /// /// Gets the integer ActionType handled by this implementation. /// /// Standard ActionType mapping: /// 0 = Email /// 1 = SMS /// 2 = Webhook /// 3 = Correspondence (document/template delivery) /// 4 = Report /// 5 = EIP Notification (SignalR push to active conversation session) /// int ActionType { get; } /// /// Executes the action asynchronously. /// /// Action event data containing payload and execution context. /// Optional cancellation token. /// Execution result indicating success, retry, or permanent failure. Task HandleAsync(ActionEventDto dto, CancellationToken ct = default); } /// /// Resolves the correct IActionHandler implementation /// based on the provided ActionType. /// public interface IActionHandlerResolver { /// /// Returns the handler associated with the given ActionType. /// Returns null if no handler is registered for that type. /// /// Integer representing the action type. /// IActionHandler instance or null if not found. IActionHandler? Resolve(int actionType); } }