// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAJBraidedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAJ.BraidedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAJOngoingStateCadenceBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAJ.OngoingStateCadences",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAJOngoingStateCadenceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCadenceBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state cadence boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCadenceBoundary(
			TEXT("validation-ongoing-state-cadence-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state cadence boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-cadence-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state cadence boundary must preserve manual-waiver cadences."),
		Boundary.CadenceIds.Contains(TEXT("ongoing-cadence/manual-waiver-cadenced"))
	);
	TestTrue(
		TEXT("The validation ongoing-state cadence boundary must preserve the bounded ongoing-state cadence surface."),
		Boundary.CadenceSurfaceTags.Contains(TEXT("bounded ongoing-state cadence"))
	);
	TestTrue(
		TEXT("The validation ongoing-state cadence boundary must preserve the no-generic-ongoing-cadence-platform guard."),
		Boundary.CadenceGuardTags.Contains(TEXT("no-generic-ongoing-cadence-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state cadence boundary must keep generic ongoing cadence platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing cadence platform ownership"))
	);
	return true;
}

#endif
