#include "HyperTwistTraining/HyperTwistTrainingSessionActor.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

namespace HyperTwistTrainingSessionActorInternal
{
	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;
	}
}

AHyperTwistTrainingSessionActor::AHyperTwistTrainingSessionActor()
{
	PrimaryActorTick.bCanEverTick = false;
}

void AHyperTwistTrainingSessionActor::BeginPlay()
{
	Super::BeginPlay();

	if (bAutoStartSampleRunOnBeginPlay)
	{
		StartSampleClassicRun();
	}
	else
	{
		RefreshCachedTrainingState();
	}
}

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

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartSampleClassicRun()
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartSampleClassicTrainingRun(
		this,
		AutoStartUserId,
		AutoStartSessionId,
		AutoStartMode
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartRunFromDeck(
	const FHyperTwistTrainingDeck& Deck,
	const FString& UserId,
	const FString& SessionId,
	EHyperTwistTrainingDeliveryMode Mode
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartTrainingRunFromDeck(
		this,
		Deck,
		UserId,
		SessionId,
		Mode
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

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

FHyperTwistTrainingSession AHyperTwistTrainingSessionActor::CompleteRun(bool bAbortSession)
{
	const FHyperTwistTrainingSession CompletedSession = UHyperTwistTrainingRuntimeLibrary::CompleteActiveTrainingRun(this, bAbortSession);
	RefreshCachedTrainingState();
	return CompletedSession;
}

void AHyperTwistTrainingSessionActor::ClearRun()
{
	UHyperTwistTrainingRuntimeLibrary::ClearActiveTrainingRun(this);
	LastStepResult = FHyperTwistTrainingRunStepResult();
	LastGeneratedModeExecutionBlockedReason.Reset();
	RefreshCachedTrainingState();
}

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

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

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

FHyperTwistVisionFinalizeResult AHyperTwistTrainingSessionActor::FinalizeActiveRecognitionSession()
{
	const FHyperTwistVisionFinalizeResult Result =
		UHyperTwistTrainingRuntimeLibrary::FinalizeActiveRecognitionSession(this);
	RefreshCachedTrainingState();
	return Result;
}

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

void AHyperTwistTrainingSessionActor::RefreshCachedTrainingState()
{
	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
	);
	CachedActiveTrainingSessionTemplates =
		UHyperTwistTrainingRuntimeLibrary::GetActiveTrainingSessionTemplates(this);
	if (AutoStartUserId.IsEmpty())
	{
		CachedAutoStartUserTrainingSessionTemplates.Reset();
	}
	else
	{
		CachedAutoStartUserTrainingSessionTemplates =
			UHyperTwistTrainingRuntimeLibrary::GetTrainingSessionTemplatesForUser(
				this,
				AutoStartUserId,
				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> AHyperTwistTrainingSessionActor::GetTrainingSessionTemplatesForUser(
	const FString& UserId,
	const FString& ReferenceUtc
)
{
	const TArray<FHyperTwistTrainingSessionTemplate> SessionTemplates =
		UHyperTwistTrainingRuntimeLibrary::GetTrainingSessionTemplatesForUser(
			this,
			UserId,
			ReferenceUtc
		);
	if (UserId == AutoStartUserId)
	{
		CachedAutoStartUserTrainingSessionTemplates = SessionTemplates;
	}

	return SessionTemplates;
}

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

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

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

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

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

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

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

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

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

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

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

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartRunFromTemplate(
	const FString& TemplateId,
	const FString& UserId,
	const FString& SessionId
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartTrainingRunFromTemplate(
		this,
		TemplateId,
		UserId,
		SessionId
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

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

FString AHyperTwistTrainingSessionActor::ResolvePrimaryCoachActionStartActionSourceLabel() const
{
	return HyperTwistTrainingSessionActorInternal::ResolvePrimaryCoachActionStartActionSourceLabel(
		CachedCoachPanelState,
		TEXT("coach-session-actor-primary-action")
	);
}

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

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

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

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

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

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

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

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

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

FHyperTwistTrainingCoachHandoffContinuationSurface
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::GetDisplayedCoachGeneratedModeLaunchExecutionContextSurface() const
{
	const FHyperTwistTrainingCoachReadinessEligibilitySurface ReadinessEligibilitySurface =
		GetDisplayedCoachReadinessEligibilitySurface();
	const FHyperTwistTrainingCoachVerificationRecognitionReviewContextSurface
		VerificationRecognitionReviewContextSurface =
			GetDisplayedCoachVerificationRecognitionReviewContextSurface();
	return UHyperTwistTrainingCoachLibrary::DeriveCoachGeneratedModeLaunchExecutionContextSurface(
		CachedCoachPanelState,
		ReadinessEligibilitySurface,
		VerificationRecognitionReviewContextSurface
	);
}

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

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

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

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

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

FHyperTwistTrainingCoachGeneratedModeSelectorOptionExecutionImpactSurface
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface(
	const FString& SelectorId
) const
{
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionMenuSurface OptionMenuSurface =
		GetDisplayedCoachGeneratedModeSelectorOptionMenuSurface(SelectorId);
	const FHyperTwistTrainingCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface
		OptionLaunchRequestPreviewSurface =
			GetDisplayedCoachGeneratedModeSelectorOptionLaunchRequestPreviewSurface(SelectorId);
	return UHyperTwistTrainingCoachLibrary::
		DeriveCoachGeneratedModeSelectorOptionLaunchRequestMetadataPreviewSurface(
			CachedRunState,
			SelectorId,
			OptionMenuSurface,
			OptionLaunchRequestPreviewSurface
		);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

FHyperTwistTrainingCoachGeneratedModeSelectorOptionOwnedExecutionSplitPhaseCurrentSelectionLabelProvenancePartitionMergedOrderedRosterPhaseIdLookupInspectSurface
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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
AHyperTwistTrainingSessionActor::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 AHyperTwistTrainingSessionActor::StartCoachRecommendedTrainingRun(
	const int32 MaxCases
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachRecommendedRun(
		this,
		AutoStartSessionId + TEXT("_coach"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Recommended)
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartCoachFollowUpTrainingRun(
	const int32 MaxCases
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachFollowUpRun(
		this,
		AutoStartSessionId + TEXT("_follow_up"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::FollowUp)
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartPrimaryCoachTrainingRun(
	const int32 MaxCases
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartPrimaryCoachAction(
		this,
		AutoStartSessionId + TEXT("_primary"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		ResolvePrimaryCoachActionStartActionSourceLabel()
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartNextQueuedCoachTrainingRun(
	const int32 MaxCases
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartNextQueuedCoachRun(
		this,
		AutoStartSessionId + TEXT("_queue"),
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Queue)
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartCoachQueueEntryTrainingRun(
	const FString& EntryId,
	const int32 MaxCases
)
{
	CachedRunState = UHyperTwistTrainingRuntimeLibrary::StartCoachQueueEntry(
		this,
		EntryId,
		AutoStartSessionId + TEXT("_queue_") + EntryId,
		MaxCases > 0 ? MaxCases : DefaultCoachMaxCases
	);
	RefreshCachedTrainingState();
	return CachedRunState;
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartDisplayedCoachRecommendedTrainingRun(
	const int32 MaxCases
)
{
	return StartCoachRecommendedTrainingRun(MaxCases);
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartDisplayedCoachFollowUpTrainingRun(
	const int32 MaxCases
)
{
	return StartCoachFollowUpTrainingRun(MaxCases);
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartDisplayedPrimaryCoachTrainingRun(
	const int32 MaxCases
)
{
	return StartPrimaryCoachTrainingRun(MaxCases);
}

FHyperTwistTrainingRunState AHyperTwistTrainingSessionActor::StartDisplayedNextQueuedCoachTrainingRun(
	const int32 MaxCases
)
{
	return StartNextQueuedCoachTrainingRun(MaxCases);
}

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

	return StartCoachQueueEntryTrainingRun(CachedCoachPanelState.ActiveQueueEntryId, MaxCases);
}

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

bool AHyperTwistTrainingSessionActor::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 AHyperTwistTrainingSessionActor::PromoteCoachQueueEntry(const FString& EntryId)
{
	const bool bSucceeded = UHyperTwistTrainingRuntimeLibrary::PromoteCoachSessionQueueEntry(
		this,
		EntryId,
		ResolveCoachHandoffStartActionSourceLabel(EHyperTwistTrainingCoachHandoffKind::Queue)
	);
	RefreshCachedTrainingState();
	return bSucceeded;
}

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

	return PromoteCoachQueueEntry(Surface.PromoteTargetEntryId);
}

FHyperTwistTrainingRepositoryRoundTripVerification
AHyperTwistTrainingSessionActor::VerifyRepositoryRoundTrip()
{
	CachedRepositoryRoundTripVerification =
		UHyperTwistTrainingRuntimeLibrary::VerifyTrainingRepositoryRoundTripAtDefaultPath(this);
	RefreshCachedTrainingState();
	return CachedRepositoryRoundTripVerification;
}
