using System;
using System.Threading;

namespace MultiWheelC.TrajectoryPlanning.EMPlanner;

/// <summary>Pure longitudinal planning facade that depends only on the solver-neutral IQpSolver boundary.</summary>
public sealed class LongitudinalPlanner
{
    private readonly SequentialLongitudinalOptimizer _optimizer;

    public LongitudinalPlanner(IQpSolver qpSolver)
    {
        _optimizer = new SequentialLongitudinalOptimizer(qpSolver ?? throw new ArgumentNullException(nameof(qpSolver)));
    }

    public LongitudinalPlanningResult Plan(LongitudinalPlanningInput input, CancellationToken cancellationToken)
    {
        return _optimizer.Optimize(input, cancellationToken);
    }
}
