#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#include "Misc/AutomationTest.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFTDalmaticStateLedgerContractTest,
	"HyperTwist.Validation.PhaseJFT.DalmaticStateLedgerContract",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFTDalmaticStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationDalmaticStateLedgerContract Contract;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationDalmaticStateLedgerContract(
		TEXT("validation-dalmatic-state-ledger-contract"),
		Contract);

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

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

	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJFTOngoingStateTunicleBoundaryTest,
	"HyperTwist.Validation.PhaseJFT.OngoingStateTunicleBoundary",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJFTOngoingStateTunicleBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateTunicleBoundary Boundary;
	const bool bResolved = UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateTunicleBoundary(
		TEXT("validation-ongoing-state-tunicle-boundary"),
		Boundary);

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

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

	return true;
}
