using System;
using F4SD.ActionConnector.Payloads;
namespace F4SD.ActionConnector.Events
{
///
/// Static event bus. F4SD calls the methods after a business event occurs.
/// The connector engine subscribes to the corresponding events and dispatches configured actions.
///
public static class ActionConnectorEvents
{
/// Raised when a support case is closed.
public static event EventHandler> CaseClosed;
/// Raised when a new support case is created.
public static event EventHandler> CaseCreated;
/// Raised once during application startup, after configuration is loaded.
public static event EventHandler> ApplicationStartup;
///
/// Raised after every sync action completes. The Cockpit Client subscribes here
/// to display results without coupling to specific trigger types.
///
public static event EventHandler ActionCompleted;
public static void RaiseCaseClosed(object sender, CaseClosedPayload payload)
=> CaseClosed?.Invoke(sender, new TriggerEventArgs(payload));
public static void RaiseCaseCreated(object sender, CaseCreatedPayload payload)
=> CaseCreated?.Invoke(sender, new TriggerEventArgs(payload));
public static void RaiseApplicationStartup(object sender, ApplicationStartupPayload payload)
=> ApplicationStartup?.Invoke(sender, new TriggerEventArgs(payload));
public static void RaiseActionCompleted(object sender, ActionCompletedEventArgs args)
=> ActionCompleted?.Invoke(sender, args);
}
}