#include "HyperTwistTraining/HyperTwistTrainingPanelWidget.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

namespace HyperTwistTrainingPanelWidgetInternal
{
	FString ResolveCoachHandoffStartActionSourceLabel(
		const FHyperTwistTrainingCoachPanelState& PanelState,
		const EHyperTwistTrainingCoachHandoffKind HandoffKind,
		const FString& FallbackSourceLabel
	)
	{
		if (HandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue
			&& !PanelState.PreferredQueueRecoveryActionSourceLabel.IsEmpty())
		{
			return PanelState.PreferredQueueRecoveryActionSourceLabel;
		}

		if (PanelState.PreferredCoachHandoffKind == HandoffKind
			&& !PanelState.PreferredCoachHandoffSourceLabel.IsEmpty())
		{
			return PanelState.PreferredCoachHandoffSourceLabel;
		}

		if ((HandoffKind == EHyperTwistTrainingCoachHandoffKind::FollowUp
				|| HandoffKind == EHyperTwistTrainingCoachHandoffKind::Recommended)
			&& !PanelState.PreferredGuidanceSourceLabel.IsEmpty())
		{
			return PanelState.PreferredGuidanceSourceLabel;
		}

		if (!PanelState.PreferredCoachHandoffSourceLabel.IsEmpty())
		{
			return PanelState.PreferredCoachHandoffSourceLabel;
		}

		if (HandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue
			&& !PanelState.NextQueueSourceLabel.IsEmpty())
		{
			return PanelState.NextQueueSourceLabel;
		}

		if (!PanelState.PreferredLaunchBudgetSourceLabel.IsEmpty())
		{
			return PanelState.PreferredLaunchBudgetSourceLabel;
		}

		return FallbackSourceLabel;
	}

	FString ResolvePrimaryCoachActionStartActionSourceLabel(
		const FHyperTwistTrainingCoachPanelState& PanelState,
		const FString& FallbackSourceLabel
	)
	{
		if (PanelState.PreferredQueueRecoveryAction != EHyperTwistTrainingQueueRecoveryAction::None)
		{
			return ResolveCoachHandoffStartActionSourceLabel(
				PanelState,
				EHyperTwistTrainingCoachHandoffKind::Queue,
				FallbackSourceLabel
			);
		}

		if (PanelState.PreferredCoachHandoffKind != EHyperTwistTrainingCoachHandoffKind::None)
		{
			return ResolveCoachHandoffStartActionSourceLabel(
				PanelState,
				PanelState.PreferredCoachHandoffKind,
				FallbackSourceLabel
			);
		}

		if (!PanelState.PreferredGuidanceSourceLabel.IsEmpty())
		{
			return PanelState.PreferredGuidanceSourceLabel;
		}

		if (!PanelState.PreferredLaunchBudgetSourceLabel.IsEmpty())
		{
			return PanelState.PreferredLaunchBudgetSourceLabel;
		}

		return FallbackSourceLabel;
	}
}

void UHyperTwistTrainingPanelWidget::NativeConstruct()
{
	Super::NativeConstruct();

	if (bRefreshOnConstruct)
	{
		RefreshTrainingState();
	}
}

bool UHyperTwistTrainingPanelWidget::HasActiveTrainingRun() const
{
	return UHyperTwistTrainingRuntimeLibrary::HasActiveTrainingRun(const_cast<UHyperTwistTrainingPanelWidget*>(this));
}

bool UHyperTwistTrainingPanelWidget::HasActiveMethodDrillRun() const
{
	return UHyperTwistTrainingRuntimeLibrary::HasActiveMethodDrillRun(
		const_cast<UHyperTwistTrainingPanelWidget*>(this));
}

void UHyperTwistTrainingPanelWidget::RefreshTrainingState()
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRunState(this);
	CachedRunSummary = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRunSummary(this);
	CachedRecognitionSessionState =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRecognitionSessionState(this);
	UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedRuntimeSelectionState(
		this,
		CachedImportedRuntimeSelectionState
	);
	UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedGeneratedModeLaunchConfig(
		this,
		CachedImportedGeneratedModeLaunchConfig
	);
	UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedGeneratedModeLaunchRequest(
		this,
		CachedImportedGeneratedModeLaunchRequest
	);
	UHyperTwistTrainingRuntimeLibrary::TryGetLatestGeneratedModeLaunchRequestForActiveDeck(
		this,
		CachedLatestGeneratedModeLaunchRequestForActiveDeck
	);
	CachedMethodDrillRunState = UHyperTwistTrainingRuntimeLibrary::GetActiveMethodDrillRunState(this);
	CachedMethodDrillSummary = UHyperTwistTrainingRuntimeLibrary::GetActiveMethodDrillSummary(this);
	CachedMethodDrillDiagnosticPacket =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingMethodDrillDiagnosticPacket(this);
	CachedMethodDrillFollowUpTemplate =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingMethodDrillFollowUpTemplate(this);
	CachedMethodDrillFollowUpDeck =
		UHyperTwistTrainingRuntimeLibrary::BuildActiveMethodDrillFollowUpDeck(this);
	CachedActiveTrainingSessionTemplates =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingSessionTemplates(this);
	if (DefaultUserId.IsEmpty())
	{
		CachedDefaultUserTrainingSessionTemplates.Reset();
	}
	else
	{
		CachedDefaultUserTrainingSessionTemplates =
			UHyperTwistTrainingRuntimeLibrary::GetTrainingSessionTemplatesForUser(
				this,
				DefaultUserId,
				FString()
			);
	}
	CachedCoachSignals = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSignals(this);
	CachedCoachBrief = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachBrief(this);
	CachedCoachFollowUpBrief = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachFollowUpBrief(this);
	CachedCoachSessionQueueSummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSessionQueueSummary(this);
	CachedCoachSessionQueueState =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSessionQueueState(this);
	CachedCoachScheduleHorizonSummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachScheduleHorizonSummary(this);
	CachedCoachSchedulePolicySummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSchedulePolicySummary(this);
	CachedCoachQueueExecutionSummary =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachSessionQueueExecutionSummary(this);
	CachedCoachPanelState = UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingCoachPanelState(this);
	CachedRepositoryRoundTripVerification =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingRepositoryRoundTripVerification(this);
}

TArray<FHyperTwistTrainingSessionTemplate> UHyperTwistTrainingPanelWidget::GetTrainingSessionTemplatesForUser(
	const FString& UserId,
	const FString& ReferenceUtc
)
{
	const TArray<FHyperTwistTrainingSessionTemplate> SessionTemplates =
		UHyperTwistTrainingRuntimeLibrary::GetTrainingSessionTemplatesForUser(
			this,
			UserId,
			ReferenceUtc
		);
	if (UserId == DefaultUserId)
	{
		CachedDefaultUserTrainingSessionTemplates = SessionTemplates;
	}

	return SessionTemplates;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartSampleClassicTrainingRun()
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartSampleClassicTrainingRun(
		this,
		DefaultUserId,
		DefaultSessionId,
		DefaultMode
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartTrainingRunFromDeck(
	const FHyperTwistTrainingDeck& Deck,
	const FString& UserId,
	const FString& SessionId,
	EHyperTwistTrainingDeliveryMode Mode
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartTrainingRunFromDeck(
		this,
		Deck,
		UserId,
		SessionId,
		Mode
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartTrainingRunFromTemplate(
	const FString& TemplateId,
	const FString& UserId,
	const FString& SessionId
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartTrainingRunFromTemplate(
		this,
		TemplateId,
		UserId,
		SessionId
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunStepResult UHyperTwistTrainingPanelWidget::SubmitTrainingAttempt(
	const FHyperTwistTrainingAttempt& Attempt,
	int32 TimeMs
)
{
	LastStepResult = UHyperTwistTrainingRuntimeLibrary::SubmitTrainingAttempt(this, Attempt, TimeMs);
	RefreshTrainingState();
	return LastStepResult;
}

FHyperTwistTrainingSession UHyperTwistTrainingPanelWidget::CompleteActiveTrainingRun(bool bAbortSession)
{
	const FHyperTwistTrainingSession CompletedSession = UHyperTwistTrainingRuntimeLibrary::CompleteActiveTrainingRun(
		this,
		bAbortSession
	);
	RefreshTrainingState();
	return CompletedSession;
}

void UHyperTwistTrainingPanelWidget::ClearActiveTrainingRun()
{
	UHyperTwistTrainingRuntimeLibrary::ClearActiveTrainingRun(this);
	LastStepResult = FHyperTwistTrainingRunStepResult();
	LastGeneratedModeExecutionBlockedReason.Reset();
	RefreshTrainingState();
}

bool UHyperTwistTrainingPanelWidget::OpenActiveRecognitionSession(FString& OutError)
{
	const bool bOpened = UHyperTwistTrainingRuntimeLibrary::OpenActiveRecognitionSession(this, OutError);
	RefreshTrainingState();
	return bOpened;
}

FHyperTwistVisionPreviewResult UHyperTwistTrainingPanelWidget::SubmitActiveRecognitionFrame(
	const FHyperTwistVisionFrameEnvelope& Frame
)
{
	const FHyperTwistVisionPreviewResult Result =
		UHyperTwistTrainingRuntimeLibrary::SubmitActiveRecognitionFrame(this, Frame);
	RefreshTrainingState();
	return Result;
}

FHyperTwistVisionCommitResult UHyperTwistTrainingPanelWidget::CommitActiveRecognitionObservation(
	const FHyperTwistVisionCommitRequest& Request
)
{
	const FHyperTwistVisionCommitResult Result =
		UHyperTwistTrainingRuntimeLibrary::CommitActiveRecognitionObservation(this, Request);
	RefreshTrainingState();
	return Result;
}

FHyperTwistVisionFinalizeResult UHyperTwistTrainingPanelWidget::FinalizeActiveRecognitionSession()
{
	const FHyperTwistVisionFinalizeResult Result =
		UHyperTwistTrainingRuntimeLibrary::FinalizeActiveRecognitionSession(this);
	RefreshTrainingState();
	return Result;
}

bool UHyperTwistTrainingPanelWidget::CloseActiveRecognitionSession(FString& OutError)
{
	const bool bClosed = UHyperTwistTrainingRuntimeLibrary::CloseActiveRecognitionSession(this, OutError);
	RefreshTrainingState();
	return bClosed;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::ApplyActiveImportedRuntimeSelectorOption(
	const FString& SelectorId,
	const FString& OptionId
)
{
	LastGeneratedModeExecutionBlockedReason.Reset();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::ApplyActiveImportedRuntimeSelectorOption(
		this,
		SelectorId,
		OptionId
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::ApplyActiveImportedGeneratedModeSelectorChoice(
	const FString& SelectorId,
	const FString& SelectedValue,
	const FString& DisplayValue
)
{
	LastGeneratedModeExecutionBlockedReason.Reset();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::ApplyActiveImportedGeneratedModeSelectorChoice(
		this,
		SelectorId,
		SelectedValue,
		DisplayValue
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingImportedGeneratedModeLaunchRequest
UHyperTwistTrainingPanelWidget::CreateActiveImportedGeneratedModeLaunchRequest(
	const FString& RequestSource
)
{
	LastGeneratedModeExecutionBlockedReason.Reset();
	CachedImportedGeneratedModeLaunchRequest =
		UHyperTwistTrainingRuntimeLibrary::CreateActiveImportedGeneratedModeLaunchRequest(
			this,
			RequestSource
		);
	RefreshTrainingState();
	return CachedImportedGeneratedModeLaunchRequest;
}

bool UHyperTwistTrainingPanelWidget::TryExecuteActiveImportedGeneratedModeLaunchRequest(
	FHyperTwistTrainingRunState& OutRunState,
	FString& OutBlockedReason
)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::TryExecuteActiveImportedGeneratedModeLaunchRequest(
		this,
		OutRunState,
		OutBlockedReason
	);
	CachedRunState = OutRunState;
	LastGeneratedModeExecutionBlockedReason = OutBlockedReason;
	RefreshTrainingState();
	return bSucceeded;
}

FHyperTwistTrainingImportedRuntimeSelectionState
UHyperTwistTrainingPanelWidget::GetDisplayedImportedRuntimeSelectionState() const
{
	return CachedImportedRuntimeSelectionState;
}

FHyperTwistTrainingImportedGeneratedModeLaunchConfig
UHyperTwistTrainingPanelWidget::GetDisplayedImportedGeneratedModeLaunchConfig() const
{
	return CachedImportedGeneratedModeLaunchConfig;
}

FHyperTwistTrainingImportedGeneratedModeLaunchRequest
UHyperTwistTrainingPanelWidget::GetDisplayedImportedGeneratedModeLaunchRequest() const
{
	return CachedImportedGeneratedModeLaunchRequest;
}

FHyperTwistTrainingImportedGeneratedModeLaunchRequest
UHyperTwistTrainingPanelWidget::GetDisplayedLatestGeneratedModeLaunchRequestForActiveDeck() const
{
	return CachedLatestGeneratedModeLaunchRequestForActiveDeck;
}

FString UHyperTwistTrainingPanelWidget::GetDisplayedGeneratedModeExecutionBlockedReason() const
{
	return LastGeneratedModeExecutionBlockedReason;
}

FHyperTwistTrainingDeck UHyperTwistTrainingPanelWidget::BuildActiveCoachRecommendedDeck(const int32 MaxCases)
{
	CachedCoachRecommendedDeck = UHyperTwistTrainingRuntimeLibrary::BuildActiveCoachRecommendedDeck(
		this,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshTrainingState();
	return CachedCoachRecommendedDeck;
}

FHyperTwistTrainingDeck UHyperTwistTrainingPanelWidget::BuildActiveCoachFollowUpDeck(const int32 MaxCases)
{
	CachedCoachFollowUpDeck = UHyperTwistTrainingRuntimeLibrary::BuildActiveCoachFollowUpDeck(
		this,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshTrainingState();
	return CachedCoachFollowUpDeck;
}

FHyperTwistTrainingDeck UHyperTwistTrainingPanelWidget::BuildActiveMethodDrillFollowUpDeck()
{
	CachedMethodDrillFollowUpDeck =
		UHyperTwistTrainingRuntimeLibrary::BuildActiveMethodDrillFollowUpDeck(this);
	RefreshTrainingState();
	return CachedMethodDrillFollowUpDeck;
}

FString UHyperTwistTrainingPanelWidget::ResolveCoachHandoffStartActionSourceLabel(
	const EHyperTwistTrainingCoachHandoffKind HandoffKind
) const
{
	return HyperTwistTrainingPanelWidgetInternal::ResolveCoachHandoffStartActionSourceLabel(
		CachedCoachPanelState,
		HandoffKind,
		FString::Printf(
			TEXT("coach-panel-%s"),
			HandoffKind == EHyperTwistTrainingCoachHandoffKind::Queue
				? TEXT("queue")
				: (HandoffKind == EHyperTwistTrainingCoachHandoffKind::FollowUp
					? TEXT("follow-up")
					: (HandoffKind == EHyperTwistTrainingCoachHandoffKind::Recommended
						? TEXT("recommended")
						: TEXT("handoff")))
		)
	);
}

FString UHyperTwistTrainingPanelWidget::ResolvePrimaryCoachActionStartActionSourceLabel() const
{
	return HyperTwistTrainingPanelWidgetInternal::ResolvePrimaryCoachActionStartActionSourceLabel(
		CachedCoachPanelState,
		TEXT("coach-panel-primary-action")
	);
}

TArray<FHyperTwistCoachSignal> UHyperTwistTrainingPanelWidget::GetDisplayedCoachSignals() const
{
	return CachedCoachSignals;
}

FHyperTwistCoachBrief UHyperTwistTrainingPanelWidget::GetDisplayedCoachBrief() const
{
	return CachedCoachBrief;
}

FHyperTwistCoachBrief UHyperTwistTrainingPanelWidget::GetDisplayedCoachFollowUpBrief() const
{
	return CachedCoachFollowUpBrief;
}

FHyperTwistCoachSessionQueueSummary
UHyperTwistTrainingPanelWidget::GetDisplayedCoachSessionQueueSummary() const
{
	return CachedCoachSessionQueueSummary;
}

FHyperTwistCoachScheduleHorizonSummary
UHyperTwistTrainingPanelWidget::GetDisplayedCoachScheduleHorizonSummary() const
{
	return CachedCoachScheduleHorizonSummary;
}

FHyperTwistCoachSchedulePolicySummary
UHyperTwistTrainingPanelWidget::GetDisplayedCoachSchedulePolicySummary() const
{
	return CachedCoachSchedulePolicySummary;
}

FHyperTwistTrainingCoachPrimaryActionSurface
UHyperTwistTrainingPanelWidget::GetDisplayedPrimaryCoachActionSurface() const
{
	FHyperTwistTrainingCoachPrimaryActionSurface Surface =
		UHyperTwistTrainingCoachLibrary::DerivePrimaryCoachActionSurface(CachedCoachPanelState);
	Surface.ActionSourceLabel = Surface.bCanExecute
		? ResolvePrimaryCoachActionStartActionSourceLabel()
		: FString();
	return Surface;
}

FHyperTwistTrainingCoachQueueControlSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachQueueControlSurface() const
{
	FHyperTwistTrainingCoachQueueControlSurface Surface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueControlSurface(
			CachedCoachSessionQueueState,
			CachedCoachPanelState
		);
	Surface.PromoteActionSourceLabel = Surface.bCanPromote
		? ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Queue)
		: FString();
	return Surface;
}

FHyperTwistTrainingCoachQueueRecoveryPostureSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachQueueRecoveryPostureSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
		CachedCoachSchedulePolicySummary,
		CachedCoachQueueExecutionSummary,
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface
	);
}

FHyperTwistTrainingCoachHandoffContinuationSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachHandoffContinuationSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface,
		QueueRecoveryPostureSurface
	);
}

FHyperTwistTrainingCoachFocusProvenanceSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachFocusProvenanceSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface,
		QueueRecoveryPostureSurface,
		HandoffContinuationSurface
	);
}

FHyperTwistTrainingCoachWorkloadBudgetSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachWorkloadBudgetSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	const FHyperTwistTrainingCoachFocusProvenanceSurface FocusProvenanceSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachWorkloadBudgetSurface(
		CachedCoachPanelState,
		QueueRecoveryPostureSurface,
		HandoffContinuationSurface,
		FocusProvenanceSurface
	);
}

FHyperTwistTrainingCoachReadinessEligibilitySurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachReadinessEligibilitySurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	const FHyperTwistTrainingCoachFocusProvenanceSurface FocusProvenanceSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface
		);
	const FHyperTwistTrainingCoachWorkloadBudgetSurface WorkloadBudgetSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachWorkloadBudgetSurface(
			CachedCoachPanelState,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface,
			FocusProvenanceSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachReadinessEligibilitySurface(
		CachedCoachPanelState,
		PrimaryActionSurface,
		QueueControlSurface,
		QueueRecoveryPostureSurface,
		HandoffContinuationSurface,
		FocusProvenanceSurface,
		WorkloadBudgetSurface
	);
}

FHyperTwistTrainingCoachVerificationRecognitionReviewContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachVerificationRecognitionReviewContextSurface() const
{
	const FHyperTwistTrainingCoachPrimaryActionSurface PrimaryActionSurface =
		GetDisplayedPrimaryCoachActionSurface();
	const FHyperTwistTrainingCoachQueueControlSurface QueueControlSurface =
		GetDisplayedCoachQueueControlSurface();
	const FHyperTwistTrainingCoachQueueRecoveryPostureSurface QueueRecoveryPostureSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachQueueRecoveryPostureSurface(
			CachedCoachSchedulePolicySummary,
			CachedCoachQueueExecutionSummary,
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface
		);
	const FHyperTwistTrainingCoachHandoffContinuationSurface HandoffContinuationSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachHandoffContinuationSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface
		);
	const FHyperTwistTrainingCoachFocusProvenanceSurface FocusProvenanceSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachFocusProvenanceSurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface
		);
	const FHyperTwistTrainingCoachWorkloadBudgetSurface WorkloadBudgetSurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachWorkloadBudgetSurface(
			CachedCoachPanelState,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface,
			FocusProvenanceSurface
		);
	const FHyperTwistTrainingCoachReadinessEligibilitySurface ReadinessEligibilitySurface =
		UHyperTwistTrainingCoachLibrary::DeriveCoachReadinessEligibilitySurface(
			CachedCoachPanelState,
			PrimaryActionSurface,
			QueueControlSurface,
			QueueRecoveryPostureSurface,
			HandoffContinuationSurface,
			FocusProvenanceSurface,
			WorkloadBudgetSurface
		);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachVerificationRecognitionReviewContextSurface(
		CachedCoachPanelState,
		FocusProvenanceSurface,
		WorkloadBudgetSurface,
		ReadinessEligibilitySurface
	);
}

FHyperTwistTrainingCoachGeneratedModeLaunchExecutionContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface() const
{
	const FHyperTwistTrainingCoachReadinessEligibilitySurface ReadinessEligibilitySurface =
		GetDisplayedCoachReadinessEligibilitySurface();
	const FHyperTwistTrainingCoachVerificationRecognitionReviewContextSurface
		VerificationRecognitionReviewContextSurface =
			GetDisplayedCoachVerificationRecognitionReviewContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeLaunchExecutionContextSurface(
		CachedCoachPanelState,
		ReadinessEligibilitySurface,
		VerificationRecognitionReviewContextSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorApplicationContextSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorApplicationContextSurface() const
{
	const FHyperTwistTrainingCoachGeneratedModeLaunchExecutionContextSurface
		LaunchExecutionContextSurface =
			GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorApplicationContextSurface(
		CachedRunState.ActiveDeck,
		CachedImportedRuntimeSelectionState,
		CachedImportedGeneratedModeLaunchConfig,
		LaunchExecutionContextSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorRosterSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorRosterSurface() const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorApplicationContextSurface
		SelectorApplicationContextSurface =
			GetDisplayedCoachGeneratedModeSelectorApplicationContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorRosterSurface(
		CachedRunState.ActiveDeck,
		CachedImportedRuntimeSelectionState,
		SelectorApplicationContextSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorRosterSurface SelectorRosterSurface =
		GetDisplayedCoachGeneratedModeSelectorRosterSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionMenuSurface(
		CachedRunState.ActiveDeck,
		CachedImportedRuntimeSelectionState,
		SelectorId,
		SelectorRosterSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionActionabilitySurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionActionabilitySurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionActionabilitySurface(
		CachedRunState.ActiveDeck,
		SelectorId,
		OptionMenuSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionActionabilitySurface
		OptionActionabilitySurface =
			GetDisplayedCoachGeneratedModeSelectorOptionActionabilitySurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionDispatchSurface(
		SelectorId,
		OptionMenuSurface,
		OptionActionabilitySurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionExecutionImpactSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionExecutionImpactSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeLaunchExecutionContextSurface
		LaunchExecutionContextSurface =
			GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface();
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionExecutionImpactSurface(
		CachedRunState,
		SelectorId,
		LaunchExecutionContextSurface,
		OptionMenuSurface,
		OptionDispatchSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionRequestAlignmentSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionRequestAlignmentSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionExecutionImpactSurface
		OptionExecutionImpactSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionExecutionImpactSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionRequestAlignmentSurface(
		CachedRunState,
		SelectorId,
		OptionMenuSurface,
		OptionDispatchSurface,
		OptionExecutionImpactSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionStoredRequestDeltaSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionStoredRequestDeltaSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionRequestAlignmentSurface
		OptionRequestAlignmentSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionRequestAlignmentSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionStoredRequestDeltaSurface(
		CachedRunState,
		SelectorId,
		OptionMenuSurface,
		OptionDispatchSurface,
		OptionRequestAlignmentSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionDispatchSurface OptionDispatchSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionDispatchSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionRequestAlignmentSurface
		OptionRequestAlignmentSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionRequestAlignmentSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(
		CachedRunState,
		SelectorId,
		OptionMenuSurface,
		OptionDispatchSurface,
		OptionRequestAlignmentSurface
	);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionCasePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionCasePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface
		OptionLaunchRequestEnvelopePreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestEnvelopePreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionCasePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestEnvelopePreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionPromptPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionPromptPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionPromptPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionPuzzleSubsetDifficultyPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionPuzzleSubsetDifficultyPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionPuzzleSubsetDifficultyPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionProvenancePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionProvenancePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionProvenancePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeckTitleSelectionPolicyPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeckTitleSelectionPolicyPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeckTitleSelectionPolicyPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeckIdRuntimeSurfaceRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeckIdRuntimeSurfaceRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeckIdRuntimeSurfaceRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryModeRosterAllowedModeRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryModeRosterAllowedModeRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionDeliveryModeRosterAllowedModeRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionRealScrambleVirtualCubeSmartCubeCapabilityRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionRealScrambleVirtualCubeSmartCubeCapabilityRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionRealScrambleVirtualCubeSmartCubeCapabilityRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionTimingPolicyRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionTimingPolicyRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionTimingPolicyRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDetailRetentionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDetailRetentionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDetailRetentionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhasePhaseIdLabelFallbackProvenancePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhasePhaseIdLabelFallbackProvenancePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhasePhaseIdLabelFallbackProvenancePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDuplicatePruningSurvivorProvenancePreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDuplicatePruningSurvivorProvenancePreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseDuplicatePruningSurvivorProvenancePreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseNormalizationSummaryPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseNormalizationSummaryPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseNormalizationSummaryPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseRawRowNormalizedPhaseFusionPreviewSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseRawRowNormalizedPhaseFusionPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseRawRowNormalizedPhaseFusionPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionCanonicalInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionCanonicalInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionCanonicalInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionSurvivorPhaseRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionSurvivorPhaseRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionSurvivorPhaseRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionDroppedRowAuditInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionDroppedRowAuditInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionDroppedRowAuditInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionPhaseIdFallbackRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionPhaseIdFallbackRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionPhaseIdFallbackRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionExplicitLabelRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionExplicitLabelRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionExplicitLabelRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionSummaryInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionSummaryInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionSummaryInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionRosterPairInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionRosterPairInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionRosterPairInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterInspectSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterInspectSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface(
	const FString& SelectorId,
	const FString& PhaseId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface(
			CachedRunState,
			SelectorId,
			PhaseId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterNormalizedOrderLookupInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterNormalizedOrderLookupInspectSurface(
	const FString& SelectorId,
	const int32 NormalizedOrder
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterNormalizedOrderLookupInspectSurface(
			CachedRunState,
			SelectorId,
			NormalizedOrder,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterEvaluationOrderLookupInspectSurface
UHyperTwistTrainingPanelWidget::GetDisplayedCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterEvaluationOrderLookupInspectSurface(
	const FString& SelectorId,
	const int32 EvaluationOrder
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterEvaluationOrderLookupInspectSurface(
			CachedRunState,
			SelectorId,
			EvaluationOrder,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartCoachRecommendedRun(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachRecommendedRun(
		this,
		DefaultSessionId + TEXT("_coach"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartCoachFollowUpRun(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachFollowUpRun(
		this,
		DefaultSessionId + TEXT("_follow_up"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartPrimaryCoachAction(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartPrimaryCoachAction(
		this,
		DefaultSessionId + TEXT("_primary"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartNextQueuedCoachRun(
	const int32 MaxCases,
	const FString& StartActionSourceLabel
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartNextQueuedCoachRun(
		this,
		DefaultSessionId + TEXT("_queue"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartCoachQueueEntry(
	const FString& EntryId,
	const int32 MaxCases
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachQueueEntry(
		this,
		EntryId,
		DefaultSessionId + TEXT("_queue_") + EntryId,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedCoachRecommendedRun(
	const int32 MaxCases
)
{
	return StartCoachRecommendedRun(
		MaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Recommended)
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedCoachFollowUpRun(
	const int32 MaxCases
)
{
	return StartCoachFollowUpRun(
		MaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::FollowUp)
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedPrimaryCoachAction(
	const int32 MaxCases
)
{
	return StartPrimaryCoachAction(MaxCases, ResolvePrimaryCoachActionStartActionSourceLabel());
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedNextQueuedCoachRun(
	const int32 MaxCases
)
{
	return StartNextQueuedCoachRun(
		MaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Queue)
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartDisplayedCoachQueueEntry(
	const int32 MaxCases
)
{
	if (CachedCoachPanelState.ActiveQueueEntryId.IsEmpty())
	{
		return FHyperTwistTrainingRunState();
	}

	return StartCoachQueueEntry(CachedCoachPanelState.ActiveQueueEntryId, MaxCases);
}

bool UHyperTwistTrainingPanelWidget::DeferCoachQueueEntry(
	const FString& EntryId,
	const FString& DeferredUntilUtc,
	const FString& DeferralReasonLabel,
	const bool bManualReschedule
)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::DeferCoachSessionQueueEntry(
		this,
		EntryId,
		DeferredUntilUtc,
		DeferralReasonLabel,
		bManualReschedule
	);
	RefreshTrainingState();
	return bSucceeded;
}

bool UHyperTwistTrainingPanelWidget::DeferDisplayedCoachQueueEntry(
	const FString& DeferredUntilUtc,
	const FString& DeferralReasonLabel,
	const bool bManualReschedule
)
{
	const FHyperTwistTrainingCoachQueueControlSurface Surface = GetDisplayedCoachQueueControlSurface();
	if (!Surface.bCanDefer || Surface.DeferTargetEntryId.IsEmpty())
	{
		return false;
	}

	return DeferCoachQueueEntry(
		Surface.DeferTargetEntryId,
		DeferredUntilUtc,
		DeferralReasonLabel,
		bManualReschedule
	);
}

bool UHyperTwistTrainingPanelWidget::PromoteCoachQueueEntry(
	const FString& EntryId,
	const FString& StartActionSourceLabel
)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::PromoteCoachSessionQueueEntry(
		this,
		EntryId,
		StartActionSourceLabel
	);
	RefreshTrainingState();
	return bSucceeded;
}

bool UHyperTwistTrainingPanelWidget::PromoteDisplayedCoachQueueEntry()
{
	const FHyperTwistTrainingCoachQueueControlSurface Surface = GetDisplayedCoachQueueControlSurface();
	if (!Surface.bCanPromote || Surface.PromoteTargetEntryId.IsEmpty())
	{
		return false;
	}

	return PromoteCoachQueueEntry(
		Surface.PromoteTargetEntryId,
		Surface.PromoteActionSourceLabel
	);
}

FHyperTwistTrainingRunState UHyperTwistTrainingPanelWidget::StartActiveMethodDrillFollowUpRun(
	const FString& SessionId
)
{
	LastStepResult = FHyperTwistTrainingRunStepResult();
	CachedRunState =
		UHyperTwistTrainingRuntimeLibrary::StartActiveMethodDrillFollowUpRun(this, SessionId);
	RefreshTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRepositoryRoundTripVerification
UHyperTwistTrainingPanelWidget::VerifyTrainingRepositoryRoundTrip()
{
	CachedRepositoryRoundTripVerification =
		UHyperTwistTrainingRuntimeLibrary::VerifyTrainingRepositoryRoundTripAtDefaultPath(this);
	RefreshTrainingState();
	return CachedRepositoryRoundTripVerification;
}
