#pragma once

#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"

#include "HyperTwistXrTrainingGameMode.generated.h"

class AHyperTwistXrTrainingPawn;

UCLASS(BlueprintType, Blueprintable)
class UNREALHYPERTWIST_API AHyperTwistXrTrainingGameMode : public AGameModeBase
{
	GENERATED_BODY()

public:
	AHyperTwistXrTrainingGameMode();

	virtual void BeginPlay() override;
	virtual void Tick(float DeltaSeconds) override;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|XR|Validation")
	bool bEnableCommandLinePackagedValidation = true;

	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist|XR|Validation", meta = (ClampMin = "0.0"))
	double DefaultValidationObservationSeconds = 8.0;

protected:
	void ApplyValidationOverridesFromCommandLine();
	AHyperTwistXrTrainingPawn* ResolveTrainingPawn() const;
	void RefreshObservedValidationState();
	bool ShouldFinalizePackagedValidationCapture() const;
	void FinalizePackagedValidationCapture();
	FString ResolveActiveCookMapAssetPath() const;

private:
	FString ValidationReportPath;
	double ConfiguredValidationObservationSeconds = 0.0;
	double RemainingValidationObservationSeconds = -1.0;
	bool bPackagedValidationRequested = false;
	bool bPackagedValidationFinalized = false;
	bool bObservedHeadMountedDisplaySessionDuringValidation = false;
	bool bObservedControllerInputActivityDuringValidation = false;
	float MaxObservedControllerInputMagnitude = 0.0f;
};
