public static WorkflowItemEvent ChildWorkflowEvent(this HistoryEvent historyEvent, IEnumerable <HistoryEvent> allEvents)
 {
     if (historyEvent.IsChildWorkflowCompletedEvent())
     {
         return(new ChildWorkflowCompletedEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsChildWorkflowFailedEvent())
     {
         return(new ChildWorkflowFailedEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsChildWorkflowCancelledEvent())
     {
         return(new ChildWorkflowCancelledEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsChildWorkflowTimedoutEvent())
     {
         return(new ChildWorkflowTimedoutEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsChildWorkflowTerminatedEvent())
     {
         return(new ChildWorkflowTerminatedEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsChildWorkflowStartedEvent())
     {
         return(new ChildWorkflowStartedEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsChildWorkflowStartFailedEvent())
     {
         return(new ChildWorkflowStartFailedEvent(historyEvent, allEvents));
     }
     if (historyEvent.IsExternalWorkflowCancelRequestedEvent())
     {
         return(new ExternalWorkflowCancellationRequestedEvent(historyEvent));
     }
     if (historyEvent.IsExternalWorkflowCancelRequestFailedEvent())
     {
         return(new ExternalWorkflowCancelRequestFailedEvent(historyEvent));
     }
     return(null);
 }
 public static WorkflowEvent CreateInterpretableEvent(this HistoryEvent historyEvent, IEnumerable <HistoryEvent> allHistoryEvents)
 {
     if (historyEvent.IsActivityCompletedEvent())
     {
         return(new ActivityCompletedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsActivityFailedEvent())
     {
         return(new ActivityFailedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsActivityTimedoutEvent())
     {
         return(new ActivityTimedoutEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsActivityCancelledEvent())
     {
         return(new ActivityCancelledEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsActivityCancellationFailedEvent())
     {
         return(new ActivityCancellationFailedEvent(historyEvent));
     }
     if (historyEvent.IsActivitySchedulingFailedEvent())
     {
         return(new ActivitySchedulingFailedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowStartedEvent())
     {
         return(new WorkflowStartedEvent(historyEvent));
     }
     if (historyEvent.IsTimerFiredEvent())
     {
         return(new TimerFiredEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsTimerFailedEvent())
     {
         return(new TimerStartFailedEvent(historyEvent));
     }
     if (historyEvent.IsTimerCancellationFailedEvent())
     {
         return(new TimerCancellationFailedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowSignaledEvent())
     {
         return(new WorkflowSignaledEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowCancellationRequestedEvent())
     {
         return(new WorkflowCancellationRequestedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowCompletionFailedEvent())
     {
         return(new WorkflowCompletionFailedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowFailureFailedEvent())
     {
         return(new WorkflowFailureFailedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowSignalFailedEvent())
     {
         return(new WorkflowSignalFailedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowCancelRequestFailedEvent())
     {
         return(new ExternalWorkflowCancelRequestFailedEvent(historyEvent));
     }
     if (historyEvent.IsWorkflowCancellationFailedEvent())
     {
         return(new WorkflowCancellationFailedEvent(historyEvent));
     }
     if (historyEvent.IsLambdaCompletedEvent())
     {
         return(new LambdaCompletedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsLambdaFailedEvent())
     {
         return(new LambdaFailedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsLambdaTimedoutEvent())
     {
         return(new LambdaTimedoutEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsLambdaSchedulingFailedEvent())
     {
         return(new LambdaSchedulingFailedEvent(historyEvent));
     }
     if (historyEvent.IsLambdaStartFailedEvent())
     {
         return(new LambdaStartFailedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsChildWorkflowCompletedEvent())
     {
         return(new ChildWorkflowCompletedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsChildWorkflowFailedEvent())
     {
         return(new ChildWorkflowFailedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsChildWorkflowCancelledEvent())
     {
         return(new ChildWorkflowCancelledEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsChildWorkflowTimedoutEvent())
     {
         return(new ChildWorkflowTimedoutEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsChildWorkflowTerminatedEvent())
     {
         return(new ChildWorkflowTerminatedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsChildWorkflowStartFailedEvent())
     {
         return(new ChildWorkflowStartFailedEvent(historyEvent, allHistoryEvents));
     }
     if (historyEvent.IsWorkflowRestartFailedEvent())
     {
         return(new WorkflowRestartFailedEvent(historyEvent));
     }
     if (historyEvent.IsChildWorkflowStartedEvent())
     {
         return(new ChildWorkflowStartedEvent(historyEvent, allHistoryEvents));
     }
     return(null);
 }