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

namespace MultiWheelC.TrajectoryPlanning.PathSmoothing;

/// <summary>路径平滑的公共配置；所有距离使用 m。</summary>
public sealed class PathSmoothingConfiguration
{
    /// <summary>创建带有安全默认值的平滑配置。</summary>
    public PathSmoothingConfiguration()
    {
        OutputSpacingMeters = 0.05d;
        MaximumCollisionCheckStepMeters = 0.025d;
        MinimumClearanceReserveMeters = 0.02d;
        SmoothingStrength = 1d;
        AllowFallbackToCoarsePath = true;
        RetryStrengthScales = new ReadOnlyCollection<double>(
            new List<double> { 1d, 0.75d, 0.50d, 0.25d });
    }

    /// <summary>正式单算法入口使用的方法。</summary>
    public SmoothingMethod Method { get; set; }

    /// <summary>输出路径的目标弧长采样间距，单位 m。</summary>
    public double OutputSpacingMeters { get; set; }

    /// <summary>扫掠碰撞检查的最大步长，单位 m。</summary>
    public double MaximumCollisionCheckStepMeters { get; set; }

    /// <summary>平滑候选必须在最小净空之外保留的额外余量，单位 m。</summary>
    public double MinimumClearanceReserveMeters { get; set; }

    /// <summary>算法初始平滑强度。</summary>
    public double SmoothingStrength { get; set; }

    /// <summary>所有平滑尝试失败时是否允许发布经过复核的原粗路径。</summary>
    public bool AllowFallbackToCoarsePath { get; set; }

    /// <summary>有限且严格递减的平滑强度重试比例。</summary>
    public IReadOnlyList<double> RetryStrengthScales { get; }

    /// <summary>三次 B 样条专用参数。</summary>
    public CubicBSplineOptions CubicBSpline { get; } = new CubicBSplineOptions();

    /// <summary>局部三次 Bézier 专用参数。</summary>
    public LocalCubicBezierOptions LocalCubicBezier { get; } = new LocalCubicBezierOptions();

    /// <summary>分段五次多项式专用参数。</summary>
    public PiecewiseQuinticOptions PiecewiseQuintic { get; } = new PiecewiseQuinticOptions();

    /// <summary>局部 G2 五次过渡专用参数。</summary>
    public LocalG2QuinticOptions LocalG2Quintic { get; } = new LocalG2QuinticOptions();
}
