using System;

namespace MultiWheelC.TrajectoryPlanning.EMPlanner;

/// <summary>Immutable trajectory-execution outcome without controller or hardware coupling.</summary>
public sealed class TrajectoryExecutionState
{
    internal TrajectoryExecutionState(EmTrajectoryPoint selectedPoint, GearSwitchStateUpdate gearSwitchUpdate)
    {
        SelectedPoint = selectedPoint ?? throw new ArgumentNullException(nameof(selectedPoint));
        if (gearSwitchUpdate == null)
            throw new ArgumentNullException(nameof(gearSwitchUpdate));

        GearSwitchState = gearSwitchUpdate.State;
        HoldZero = gearSwitchUpdate.HoldZero;
        RequestDirectionChange = gearSwitchUpdate.RequestDirectionChange;
        AllowsTrajectoryMotion = gearSwitchUpdate.AllowsTrajectoryMotion;
        IsTrajectoryComplete = gearSwitchUpdate.IsTrajectoryComplete;
        Reason = gearSwitchUpdate.Reason;
    }

    public EmTrajectoryPoint SelectedPoint { get; }

    public GearSwitchState GearSwitchState { get; }

    public bool HoldZero { get; }

    public bool RequestDirectionChange { get; }

    public bool AllowsTrajectoryMotion { get; }

    public bool IsTrajectoryComplete { get; }

    public string Reason { get; }
}
