Drone mission waypoint reorder and switch while in flight

Hello everyone

I have an idea but ai am searching for a method to do it.

So, I have a drone running on ardupilot firmware with jetson nano companion computer.
I will upload a survey mission with waypoint 1,2,3,4,5. And then based on some data from the jetson nano I want to re order the waypoints to be for example 3.2,4,5,1.

What mavlink command I can use and how to do it ?

Thanks