#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCIColumnStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCI.ColumnStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCIColumnStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationColumnStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationColumnStatePacketContract(
		TEXT("validation-column-state-packet-contract"),
		Contract);

	TestTrue(
		TEXT("The validation column-state packet contract must resolve from the runtime library."),
		bResolved);
	if (!bResolved)
	{
		return false;
	}

	TestEqual(
		TEXT("The validation column-state packet contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-column-state-packet-contract")));
	TestTrue(
		TEXT("The validation column-state packet contract must preserve benchmark-drift column packets."),
		Contract.PacketIds.Contains(TEXT("column-state-packet/benchmark-drift-column")));
	TestTrue(
		TEXT("The validation column-state packet contract must preserve the bounded column-state packet surface."),
		Contract.PacketSurfaceTags.Contains(TEXT("bounded column-state packet")));
	TestTrue(
		TEXT("The validation column-state packet contract must preserve the no-generic-column-state-platform guard."),
		Contract.ColumnGuardTags.Contains(TEXT("no-generic-column-state-platform guard")));
	TestTrue(
		TEXT("The validation column-state packet contract must keep generic column-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic column-state platform ownership")));

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCIOngoingStateAccoladeBoundaryTest,
	"HyperTwist.Validation.PhaseJCI.OngoingStateAccoladeBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCIOngoingStateAccoladeBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateAccoladeBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateAccoladeBoundary(
		TEXT("validation-ongoing-state-accolade-boundary"),
		Boundary);

	TestTrue(
		TEXT("The validation ongoing-state accolade boundary must resolve from the runtime library."),
		bResolved);
	if (!bResolved)
	{
		return false;
	}

	TestEqual(
		TEXT("The validation ongoing-state accolade boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-accolade-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state accolade boundary must preserve manual-waiver accolade anchors."),
		Boundary.AccoladeIds.Contains(TEXT("ongoing-accolade/manual-waiver-accolade")));
	TestTrue(
		TEXT("The validation ongoing-state accolade boundary must preserve the bounded ongoing-state accolade surface."),
		Boundary.AccoladeSurfaceTags.Contains(TEXT("bounded ongoing-state accolade")));
	TestTrue(
		TEXT("The validation ongoing-state accolade boundary must preserve the no-generic-ongoing-accolade-platform guard."),
		Boundary.AccoladeGuardTags.Contains(TEXT("no-generic-ongoing-accolade-platform guard")));
	TestTrue(
		TEXT("The validation ongoing-state accolade boundary must keep generic ongoing accolade platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing accolade platform ownership")));

	return true;
}
