// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAHWovenStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAH.WovenStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAHOngoingStateResonanceBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAH.OngoingStateResonances",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAHOngoingStateResonanceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateResonanceBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state resonance boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateResonanceBoundary(
			TEXT("validation-ongoing-state-resonance-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state resonance boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-resonance-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state resonance boundary must preserve manual-waiver resonances."),
		Boundary.ResonanceIds.Contains(TEXT("ongoing-resonance/manual-waiver-resonant"))
	);
	TestTrue(
		TEXT("The validation ongoing-state resonance boundary must preserve the bounded ongoing-state resonance surface."),
		Boundary.ResonanceSurfaceTags.Contains(TEXT("bounded ongoing-state resonance"))
	);
	TestTrue(
		TEXT("The validation ongoing-state resonance boundary must preserve the no-generic-ongoing-resonance-platform guard."),
		Boundary.ResonanceGuardTags.Contains(TEXT("no-generic-ongoing-resonance-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state resonance boundary must keep generic ongoing resonance platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing resonance platform ownership"))
	);
	return true;
}

#endif
