[SOLVED]Camera Rotation issues

So my camera is following a way point system where the camera moves between the two positions and stays focused on the same point. I want the camera once it stops moving to be able to move when the player right clicks, here is my code:

void Update()
    {
        camStuff.Reset();
        rotStuff.Reset();

        rotStuff.mousePos = Input.mousePosition;

        camStuff.cameraPos = mainCam.transform.position;

        if(Input.mousePosition != rotStuff.mouseOldPos && moving == false && Input.GetMouseButtonDown(1))
        {
            RotateCamera();
        }

        if(camStuff.cameraPos != camStuff.oldCameraPos)
        {
            moving = true;
        } else
        {
            moving = false;
        }

        if (Input.GetMouseButtonDown(0))
        {
            MoveCamera();
        }
    }
    /*

Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
// Translate along world cordinates. (Done this way so we can angle the camera freely.)
transform.position -= new Vector3(touchDeltaPosition.x* PanSpeed, 0, touchDeltaPosition.y* PanSpeed);
*/
    void RotateCamera()
    {
        mainCam.transform.rotation = new Vector3(rotStuff.mouseOldPos.x * mouseSensitivity, 0, rotStuff.mouseOldPos.y * mouseSensitivity);
    }

struct RotationStuff
    {
        public Vector3 mouseOldPos;
        public Vector3 mousePos;

        public void Reset()
        {
            mouseOldPos = mousePos;
            mousePos = Vector3.zero;
        }
    }

Thank you.

Whats the solution ?

using UnityEngine;
using DG.Tweening;

public class CameraWaypoints : MonoBehaviour
{
    public float transitionDuration = 1.0f;
    public Transform[] posiblePositions;

    public Transform targetPosForRotation;

    public Transform mainCam;

    public bool moving = false;

    CameraStuff camStuff;

    float verticalRotation = 0;
    public float upDownRange = 90.0f;

    public float mouseSensitivity = 5f;

    void Update()
    {
        camStuff.Reset();

        camStuff.cameraPos = mainCam.transform.position;

        if(moving == false && Input.GetMouseButton(1))
        {
            float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
            transform.Rotate(0, rotLeftRight, 0);

            verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity;
            verticalRotation = Mathf.Clamp(verticalRotation, -upDownRange, upDownRange);
            Camera.main.transform.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
        }

        if(camStuff.cameraPos != camStuff.oldCameraPos)
        {
            moving = true;
        } else
        {
            moving = false;
        }

        if (Input.GetMouseButtonDown(0))
        {
            MoveCamera();
        }
    }

    void MoveCamera()
    {
        int randomSpot = Random.Range(0, posiblePositions.Length);

        if(posiblePositions[randomSpot].position != mainCam.transform.position)
        {
            Vector3 destination = posiblePositions[randomSpot].position;
            var lookAtRotation = Quaternion.LookRotation((targetPosForRotation.position - destination).normalized);

            mainCam.transform.DOMove(destination, transitionDuration);
            mainCam.transform.DORotateQuaternion(lookAtRotation, transitionDuration);
        } else
        {
            MoveCamera();
        }
    }
  
    struct CameraStuff
    {
        public Vector2 oldCameraPos;
        public Vector2 cameraPos;

        public void Reset()
        {
            oldCameraPos = cameraPos;
            cameraPos = Vector2.zero;
        }
    }
}