#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCQTriglyphStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCQ.TriglyphStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCQTriglyphStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationTriglyphStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationTriglyphStatePacketContract(
		TEXT("validation-triglyph-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCQOngoingStateEsteemBoundaryTest,
	"HyperTwist.Validation.PhaseJCQ.OngoingStateEsteemBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCQOngoingStateEsteemBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEsteemBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEsteemBoundary(
		TEXT("validation-ongoing-state-esteem-boundary"),
		Boundary);

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

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

	return true;
}
