recording and playing the mouse and keyboard events using Delphi

I'm using Delphi 10.1 for developing VCL application. And in that application, I need to record all the mouse events (eg: Onclick.,) and also need to record the all mouse pointer locations and also need to record the keyboard events which is happening inside the application. Then, I need to play the same actions again. Is there any help files to implement this functionality.

Thanks in advance.