#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFXZucchettoStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFX.ZucchettoStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFXZucchettoStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationZucchettoStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationZucchettoStateLedgerContract(
		TEXT("validation-zucchetto-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFXOngoingStateBirettaBoundaryTest,
	"HyperTwist.Validation.PhaseJFX.OngoingStateBirettaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFXOngoingStateBirettaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateBirettaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateBirettaBoundary(
		TEXT("validation-ongoing-state-biretta-boundary"),
		Boundary);

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

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

	return true;
}
