#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCEAbutmentStatePacketContractTest,
	"HyperTwist.Validation.PhaseJCE.AbutmentStatePacketContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCEAbutmentStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationAbutmentStatePacketContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationAbutmentStatePacketContract(
		TEXT("validation-abutment-state-packet-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJCEOngoingStateCommendationBoundaryTest,
	"HyperTwist.Validation.PhaseJCE.OngoingStateCommendationBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJCEOngoingStateCommendationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCommendationBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCommendationBoundary(
		TEXT("validation-ongoing-state-commendation-boundary"),
		Boundary);

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

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

	return true;
}
