// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJALSpiraledStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAL.SpiraledStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJALSpiraledStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationSpiraledStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation spiraled-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationSpiraledStateLedgerContract(
			TEXT("validation-spiraled-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation spiraled-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-spiraled-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation spiraled-state ledger contract must preserve benchmark-drift spiraled entries."),
		Contract.LedgerEntryIds.Contains(TEXT("spiraled-state-ledger/benchmark-drift-spiraled"))
	);
	TestTrue(
		TEXT("The validation spiraled-state ledger contract must preserve the bounded spiraled-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded spiraled-state ledger"))
	);
	TestTrue(
		TEXT("The validation spiraled-state ledger contract must preserve the no-generic-spiraled-state-platform guard."),
		Contract.SpiraledGuardTags.Contains(TEXT("no-generic-spiraled-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation spiraled-state ledger contract must keep generic spiraled-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic spiraled-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJALOngoingStateChorusBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAL.OngoingStateChoruses",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJALOngoingStateChorusBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateChorusBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state chorus boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateChorusBoundary(
			TEXT("validation-ongoing-state-chorus-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state chorus boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-chorus-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state chorus boundary must preserve manual-waiver choruses."),
		Boundary.ChorusIds.Contains(TEXT("ongoing-chorus/manual-waiver-chorused"))
	);
	TestTrue(
		TEXT("The validation ongoing-state chorus boundary must preserve the bounded ongoing-state chorus surface."),
		Boundary.ChorusSurfaceTags.Contains(TEXT("bounded ongoing-state chorus"))
	);
	TestTrue(
		TEXT("The validation ongoing-state chorus boundary must preserve the no-generic-ongoing-chorus-platform guard."),
		Boundary.ChorusGuardTags.Contains(TEXT("no-generic-ongoing-chorus-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state chorus boundary must keep generic ongoing chorus platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing chorus platform ownership"))
	);
	return true;
}

#endif
