#include "HyperTwistSimulation/HyperTwistSimulationLibrary.h"

#include "HyperTwistBootstrap/HyperTwistContractLibrary.h"
#include "HyperTwistSimulation/HyperTwistVirtual3333ProjectionLibrary.h"

FHyperTwistSimulationSceneContext UHyperTwistSimulationLibrary::MakeClassicSampleSceneContext()
{
	FHyperTwistSimulationSceneContext SceneContext;
	SceneContext.SceneContextId = TEXT("scene_classic_sample");
	SceneContext.PuzzleState = UHyperTwistContractLibrary::MakeSampleClassicPuzzleState();
	SceneContext.ProjectionSettings.ProjectionKind = EHyperTwistProjectionKind::ClassicPerspective;
	SceneContext.ProjectionSettings.ProjectionProfile = TEXT("classic-default");
	SceneContext.RenderStateProfile = TEXT("classic-sample-render-state");
	return SceneContext;
}

FHyperTwistSimulationSceneContext UHyperTwistSimulationLibrary::MakeHyperSampleSceneContext()
{
	FHyperTwistSimulationSceneContext SceneContext;
	SceneContext.SceneContextId = TEXT("scene_hyper_sample");
	SceneContext.PuzzleState = UHyperTwistContractLibrary::MakeSampleHyperPuzzleState();
	SceneContext.ProjectionSettings.ProjectionKind = EHyperTwistProjectionKind::HyperProjection;
	SceneContext.ProjectionSettings.ProjectionProfile = TEXT("hyper-default");
	SceneContext.ProjectionSettings.ProjectionDepth = 2.0f;
	SceneContext.RenderStateProfile = TEXT("hyper-sample-render-state");
	return SceneContext;
}

FHyperTwistSimulationSceneContext UHyperTwistSimulationLibrary::MakeClassicPlaceholderSceneContext()
{
	return MakeClassicSampleSceneContext();
}

FHyperTwistSimulationSceneContext UHyperTwistSimulationLibrary::MakeHyperPlaceholderSceneContext()
{
	return MakeHyperSampleSceneContext();
}

FHyperTwistSimulationSceneContext UHyperTwistSimulationLibrary::MakeMelindaCellFirstSceneContext()
{
	FHyperTwistSimulationSceneContext SceneContext;
	SceneContext.SceneContextId = TEXT("scene_hyper_melinda_cell_first");
	SceneContext.PuzzleState = UHyperTwistContractLibrary::MakeSampleHyperPuzzleState();
	SceneContext.ProjectionSettings.ProjectionKind = EHyperTwistProjectionKind::HyperProjection;
	SceneContext.ProjectionSettings.ProjectionProfile =
		TEXT("melinda-2x2x2x2-cell-first-projection-v1");
	SceneContext.ProjectionSettings.ProjectionDepth = 4.0f;
	SceneContext.RenderStateProfile = TEXT("melinda-cell-first-procedural-runtime-v1");
	return SceneContext;
}

FHyperTwistSimulationSceneContext UHyperTwistSimulationLibrary::MakeVirtual3333VisibleSceneContext()
{
	FHyperTwistSimulationSceneContext SceneContext;
	SceneContext.SceneContextId = TEXT("scene_hyper_virtual_3x3x3x3_visible_slice");
	SceneContext.PuzzleState = UHyperTwistVirtual3333ProjectionLibrary::BuildPuzzleStateEnvelope(
		UHyperTwistVirtual3333ProjectionLibrary::BuildSolvedState()
	);
	SceneContext.ProjectionSettings.ProjectionKind = EHyperTwistProjectionKind::HyperProjection;
	SceneContext.ProjectionSettings.ProjectionProfile =
		TEXT("hypercube-3x3x3x3-visible-slice-projection-v1");
	SceneContext.ProjectionSettings.ProjectionDepth = 5.0f;
	SceneContext.RenderStateProfile = TEXT("virtual-3x3x3x3-visible-slice-procedural-runtime-v1");
	return SceneContext;
}

bool UHyperTwistSimulationLibrary::CanRenderSceneContext(const FHyperTwistSimulationSceneContext& SceneContext)
{
	return SceneContext.IsStructurallyValid();
}
