#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHHApolysisStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJHH.ApolysisStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHHApolysisStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationApolysisStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationApolysisStateLedgerContract(
		TEXT("validation-apolysis-state-ledger-contract"),
		Contract);

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

	TestEqual(
		TEXT("The validation apolysis-state ledger contract id must stay stable."),
		Contract.ContractId,
		FString(TEXT("validation-apolysis-state-ledger-contract")));
	TestTrue(
		TEXT("The validation apolysis-state ledger contract must be structurally valid."),
		Contract.IsStructurallyValid());
	TestTrue(
		TEXT("The validation apolysis-state ledger contract must carry first-party source attribution."),
		Contract.SourceAttribution.IsStructurallyValid());
	TestTrue(
		TEXT("The validation apolysis-state ledger contract must carry at least one ledger id."),
		Contract.LedgerIds.Num() > 0);
	TestTrue(
		TEXT("The validation apolysis-state ledger contract must carry at least one guard tag."),
		Contract.ApolysisGuardTags.Num() > 0);
	TestTrue(
		TEXT("The validation apolysis-state ledger contract must carry at least one explicit exclusion."),
		Contract.ExplicitExclusions.Num() > 0);

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJHHOngoingStateEulogiaBoundaryTest,
	"HyperTwist.Validation.PhaseJHH.OngoingStateEulogiaBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJHHOngoingStateEulogiaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateEulogiaBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateEulogiaBoundary(
		TEXT("validation-ongoing-state-eulogia-boundary"),
		Boundary);

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

	TestEqual(
		TEXT("The validation ongoing-state eulogia boundary id must stay stable."),
		Boundary.BoundaryId,
		FString(TEXT("validation-ongoing-state-eulogia-boundary")));
	TestTrue(
		TEXT("The validation ongoing-state eulogia boundary must be structurally valid."),
		Boundary.IsStructurallyValid());
	TestTrue(
		TEXT("The validation ongoing-state eulogia boundary must carry first-party source attribution."),
		Boundary.SourceAttribution.IsStructurallyValid());
	TestTrue(
		TEXT("The validation ongoing-state eulogia boundary must carry at least one eulogia id."),
		Boundary.EulogiaIds.Num() > 0);
	TestTrue(
		TEXT("The validation ongoing-state eulogia boundary must carry at least one guard tag."),
		Boundary.EulogiaGuardTags.Num() > 0);
	TestTrue(
		TEXT("The validation ongoing-state eulogia boundary must carry at least one explicit exclusion."),
		Boundary.ExplicitExclusions.Num() > 0);

	return true;
}
