#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGJEpigonationStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJGJ.EpigonationStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGJEpigonationStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEpigonationStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEpigonationStateLedgerContract(
		TEXT("validation-epigonation-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJGJOngoingStateEpimanikiaBoundaryTest,
	"HyperTwist.Validation.PhaseJGJ.OngoingStateEpimanikiaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJGJOngoingStateEpimanikiaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEpimanikiaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEpimanikiaBoundary(
		TEXT("validation-ongoing-state-epimanikia-boundary"),
		Boundary);

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

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

	return true;
}
