namespace AGVNavigationCore.Models
{
    /// <summary>
    /// AGV 제어 명령 클래스 (실제 AGV 제어용)
    /// Predict() 메서드가 반환하는 다음 동작 명령
    /// </summary>
    public class AGVCommand
    {
        /// <summary>모터 명령 (정지/전진/후진)</summary>
        public MotorCommand Motor { get; set; }

        /// <summary>마그넷 위치 (직진/왼쪽/오른쪽)</summary>
        public MagnetPosition Magnet { get; set; }

        /// <summary>속도 레벨 (저속/중속/고속)</summary>
        public SpeedLevel Speed { get; set; }

        /// <summary>명령 이유 메세지- (디버깅/로깅용)</summary>
        public string Message { get; set; }

        /// <summary>명령 이유- (디버깅/로깅용)</summary>
        public eAGVCommandReason Reason { get; set; }

        /// <summary>방향 전환 명령 여부 (180도 Left Turn 등)</summary>
        public bool IsTurn { get; set; }

        /// <summary>
        /// 생성자
        /// </summary>
        public AGVCommand(MotorCommand motor, MagnetPosition magnet, SpeedLevel speed, eAGVCommandReason reason, string reasonmessage = "")
        {
            Motor = motor;
            Magnet = magnet;
            Speed = speed;
            Reason = reason;
            Message = reasonmessage;
        }

        /// <summary>
        /// 기본 생성자
        /// </summary>
        public AGVCommand()
        {
            Motor = MotorCommand.Stop;
            Magnet = MagnetPosition.S;
            Speed = SpeedLevel.L;
            Message = "";
            Reason = eAGVCommandReason.Normal;
        }

        public override string ToString()
        {
            return $"Motor:{Motor}, Magnet:{Magnet}, Speed:{Speed},Reason:{Reason}" +
                   (string.IsNullOrEmpty(Message) ? "" : $" ({Message})");
        }
    }
}