#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDPDoucineStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJDP.DoucineStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDPDoucineStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDoucineStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDoucineStateLedgerContract(
		TEXT("validation-doucine-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJDPOngoingStateSociabilityBoundaryTest,
	"HyperTwist.Validation.PhaseJDP.OngoingStateSociabilityBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJDPOngoingStateSociabilityBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSociabilityBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSociabilityBoundary(
		TEXT("validation-ongoing-state-sociability-boundary"),
		Boundary);

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

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

	return true;
}
