#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDRCymaReversaStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJDR.CymaReversaStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDRCymaReversaStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationCymaReversaStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationCymaReversaStateLedgerContract(
		TEXT("validation-cyma-reversa-state-ledger-contract"),
		Contract);

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

	TestEqual(
		TEXT("The validation cyma-reversa-state ledger contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-cyma-reversa-state-ledger-contract")));
	TestTrue(
		TEXT("The validation cyma-reversa-state ledger contract must preserve benchmark-drift cyma-reversa ledgers."),
		Contract.LedgerIds.Contains(TEXT("cyma-reversa-state-ledger/benchmark-drift-cyma-reversa")));
	TestTrue(
		TEXT("The validation cyma-reversa-state ledger contract must preserve the bounded cyma-reversa-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded cyma-reversa-state ledger")));
	TestTrue(
		TEXT("The validation cyma-reversa-state ledger contract must preserve the no-generic-cyma-reversa-state-platform guard."),
		Contract.CymaReversaGuardTags.Contains(TEXT("no-generic-cyma-reversa-state-platform guard")));
	TestTrue(
		TEXT("The validation cyma-reversa-state ledger contract must keep generic cyma-reversa-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic cyma-reversa-state platform ownership")));

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDROngoingStateCamaraderieBoundaryTest,
	"HyperTwist.Validation.PhaseJDR.OngoingStateCamaraderieBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDROngoingStateCamaraderieBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCamaraderieBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCamaraderieBoundary(
		TEXT("validation-ongoing-state-camaraderie-boundary"),
		Boundary);

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

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

	return true;
}
