using Microsoft.VisualStudio.TestTools.UnitTesting;
using NavisworksTransport.Utils.CoordinateSystem;

namespace NavisworksTransport.UnitTests.CoordinateSystem
{
    [TestClass]
    public class ObjectStartPlacementRequestTests
    {
        [TestMethod]
        public void TranslationOnly_ShouldPreserveInitialPoseAndClearRotationCorrection()
        {
            var request = ObjectStartPlacementRequest.TranslationOnly;

            Assert.AreEqual(ObjectStartPlacementMode.PreserveInitialPose, request.PlacementMode);
            Assert.IsTrue(request.PreserveInitialPose);
            Assert.AreEqual(LocalEulerRotationCorrection.Zero, request.RotationCorrection);
            Assert.AreEqual(0.0, request.VerticalLiftInMeters, 1e-9);
        }

        [TestMethod]
        public void RotationCorrectionRequest_ShouldKeepCorrectionAndAlignToPathPose()
        {
            var correction = new LocalEulerRotationCorrection(15.0, 30.0, 45.0);

            var request = ObjectStartPlacementRequest.CreateRotationCorrection(correction, 0.35);

            Assert.AreEqual(ObjectStartPlacementMode.AlignToPathPose, request.PlacementMode);
            Assert.IsFalse(request.PreserveInitialPose);
            Assert.AreEqual(correction, request.RotationCorrection);
            Assert.AreEqual(0.35, request.VerticalLiftInMeters, 1e-9);
        }

        [TestMethod]
        public void TranslationOnlyRequest_ShouldKeepVerticalLift()
        {
            var request = ObjectStartPlacementRequest.CreateTranslationOnly(0.28);

            Assert.AreEqual(ObjectStartPlacementMode.PreserveInitialPose, request.PlacementMode);
            Assert.IsTrue(request.PreserveInitialPose);
            Assert.AreEqual(LocalEulerRotationCorrection.Zero, request.RotationCorrection);
            Assert.AreEqual(0.28, request.VerticalLiftInMeters, 1e-9);
        }
    }
}
