// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAXGroovedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAX.GroovedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAXGroovedStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationGroovedStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation grooved-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationGroovedStateLedgerContract(
			TEXT("validation-grooved-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation grooved-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-grooved-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation grooved-state ledger contract must preserve benchmark-drift grooved ledgers."),
		Contract.LedgerIds.Contains(TEXT("grooved-state-ledger/benchmark-drift-grooved"))
	);
	TestTrue(
		TEXT("The validation grooved-state ledger contract must preserve the bounded grooved-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded grooved-state ledger"))
	);
	TestTrue(
		TEXT("The validation grooved-state ledger contract must preserve the no-generic-grooved-state-platform guard."),
		Contract.GroovedGuardTags.Contains(TEXT("no-generic-grooved-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation grooved-state ledger contract must keep generic grooved-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic grooved-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAXOngoingStateSealBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAX.OngoingStateSeals",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAXOngoingStateSealBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSealBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state seal boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSealBoundary(
			TEXT("validation-ongoing-state-seal-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state seal boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-seal-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state seal boundary must preserve manual-waiver seals."),
		Boundary.SealIds.Contains(TEXT("ongoing-seal/manual-waiver-seal"))
	);
	TestTrue(
		TEXT("The validation ongoing-state seal boundary must preserve the bounded ongoing-state seal surface."),
		Boundary.SealSurfaceTags.Contains(TEXT("bounded ongoing-state seal"))
	);
	TestTrue(
		TEXT("The validation ongoing-state seal boundary must preserve the no-generic-ongoing-seal-platform guard."),
		Boundary.SealGuardTags.Contains(TEXT("no-generic-ongoing-seal-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state seal boundary must keep generic ongoing seal platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing seal platform ownership"))
	);
	return true;
}

#endif
