using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace MultiWheelC.TrajectoryPlanning.PathSmoothing.Output.Comparison;

/// <summary>Immutable request for comparing a coarse-path baseline with Local G2 output.</summary>
public sealed class PathSmoothingComparisonRequest
{
    private static readonly IReadOnlyList<SmoothingMethod> LocalG2OnlyMethods =
        new ReadOnlyCollection<SmoothingMethod>(new[] { SmoothingMethod.LocalG2Quintic });

    public PathSmoothingComparisonRequest(PathSmoothingRequest smoothingRequest)
    {
        SmoothingRequest = CopyRequest(smoothingRequest);
        Methods = LocalG2OnlyMethods;
    }

    public PathSmoothingRequest SmoothingRequest { get; }

    /// <summary>The report always contains the sole supported method, Local G2 quintic.</summary>
    public IReadOnlyList<SmoothingMethod> Methods { get; }

    private static PathSmoothingRequest CopyRequest(PathSmoothingRequest source)
    {
        if (source == null) return null;
        return new PathSmoothingRequest(
            source.CoarsePath,
            source.Segments,
            source.Map,
            source.Vehicle,
            source.Configuration);
    }
}
