using System;
namespace OpenNest;
///
/// Bridges legacy reporting into job progress while a candidate
/// trial is being evaluated. Used by both the legacy adapter and the migrated built-in nesters so the
/// stage/context mapping has one implementation.
///
internal static class CandidateProgressBridge
{
internal static IProgress Create(
IProgress progress,
string stockId
)
{
if (progress == null)
return null;
return new LegacyToJob(progress, stockId);
}
private sealed class LegacyToJob(IProgress progress, string stockId)
: IProgress
{
public void Report(NestProgress value)
{
ArgumentNullException.ThrowIfNull(value);
progress.Report(
new NestJobProgress(NestJobStage.EvaluatingCandidate, stockId, -1, 0, 0, value)
);
}
}
}