using System;
using Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses.Enum;
namespace Xylem.Common.Production.ProductionUiCordonel.ProductionProcesses
{
///
/// Concatenation between test state and text feeding the state machine with next state.
///
public struct ProcessStateStruct
{
///
/// Assign process state information
///
/// production process, set to null for "invisible" states
/// assigned state for call of this process used by the state machine
/// name for process to display a message in the GUI
/// set a unique number to sort the table of production processes,
/// set to null for all hidden processes which are not a production process
/// BaseProductionProcess.DoNotChangeStateAfterCompletion will not
/// change the state automatically
///
///
/// start a parallel process
/// wait for single processes to complete before execution
/// wait for all processes to complete before execution
/// start even if abort is required
///
/// - Initial
///
///
/// - Extended to steer state machine with this struct.
///
public ProcessStateStruct(IProductionProcess productionProcess, ProcessState processState, String processInfo,
UInt32? productionProcessNo, ProcessState? nextStateOnSuccess, ProcessState errorExitState = ProcessState.Error,
ProcessState breakExitState = ProcessState.Stop,
ProcessState? kickOffParallelState = null,
ProcessState? waitForSingleProcess = null,
Boolean waitForAllProcesses = false, Boolean startAlways = false)
{
ProductionProcess = productionProcess;
ProcessState = processState;
ProcessInfo = processInfo;
ProductionProcessNo = productionProcessNo;
NextStateOnSuccess = nextStateOnSuccess;
ErrorExitState = errorExitState;
BreakExitState = breakExitState;
KickOffParallelState = kickOffParallelState;
WaitForSingleProcess = waitForSingleProcess;
WaitForAllProcesses = waitForAllProcesses;
StartAlways = startAlways;
}
///
/// Start a parallel process
///
public ProcessState? KickOffParallelState { get; }
///
/// The state of the final test
///
public IProductionProcess ProductionProcess { get; }
///
/// The state of the final test
///
public ProcessState ProcessState { get; }
///
/// The info message of the state
///
public String ProcessInfo { get; }
///
/// Processes which are relevant for the production have a number for the sequence they should be displayed
/// in the GUI, all hidden (non-)production processes are set to null
///
public UInt32? ProductionProcessNo { get; }
///
/// Next state required after successfully execution
///
public ProcessState? NextStateOnSuccess { get; }
///
/// Special state used for error or for the second output of the process
///
public ProcessState ErrorExitState { get; }
///
/// Special state required on user break
///
public ProcessState BreakExitState { get; }
///
/// Wait for a single process named here to take the result into account
///
public ProcessState? WaitForSingleProcess { get; }
///
/// Wait until all preceding processes are finished with success
///
public Boolean WaitForAllProcesses { get; }
///
/// Sate which has to be active always even if a predecessor failed (e.g. error state)
///
public Boolean StartAlways { get; }
}
}