// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBNEmbrasureStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBN.EmbrasureStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBNEmbrasureStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationEmbrasureStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation embrasure-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationEmbrasureStateLedgerContract(
			TEXT("validation-embrasure-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation embrasure-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-embrasure-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation embrasure-state ledger contract must preserve benchmark-drift embrasure ledgers."),
		Contract.LedgerIds.Contains(TEXT("embrasure-state-ledger/benchmark-drift-embrasure"))
	);
	TestTrue(
		TEXT("The validation embrasure-state ledger contract must preserve the bounded embrasure-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded embrasure-state ledger"))
	);
	TestTrue(
		TEXT("The validation embrasure-state ledger contract must preserve the no-generic-embrasure-state-platform guard."),
		Contract.EmbrasureGuardTags.Contains(TEXT("no-generic-embrasure-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation embrasure-state ledger contract must keep generic embrasure-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic embrasure-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBNOngoingStateSidenoteBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBN.OngoingStateSidenotes",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBNOngoingStateSidenoteBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateSidenoteBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state sidenote boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateSidenoteBoundary(
			TEXT("validation-ongoing-state-sidenote-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state sidenote boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-sidenote-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state sidenote boundary must preserve manual-waiver sidenotes."),
		Boundary.SidenoteIds.Contains(TEXT("ongoing-sidenote/manual-waiver-sidenote"))
	);
	TestTrue(
		TEXT("The validation ongoing-state sidenote boundary must preserve the bounded ongoing-state sidenote surface."),
		Boundary.SidenoteSurfaceTags.Contains(TEXT("bounded ongoing-state sidenote"))
	);
	TestTrue(
		TEXT("The validation ongoing-state sidenote boundary must preserve the no-generic-ongoing-sidenote-platform guard."),
		Boundary.SidenoteGuardTags.Contains(TEXT("no-generic-ongoing-sidenote-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state sidenote boundary must keep generic ongoing sidenote platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing sidenote platform ownership"))
	);
	return true;
}

#endif
