The best is to contact HP customer service and order a restore disc. That has all you need.
Installing a retail version of Windows 10 is a first step. After that, you'll have to install drivers and software from hp.com. It's much more work and more expensive moreover.
I have an hp pavillion 2 in 1 convertible foldable laptop and the hard drive crashed and since i really needed the computer a friend installed a less than active version of windows 7 on a newer hard drive so i could at least use it, but almost none of my features including touch screen or wifi work. If i buy windows 10 (software it came with) wipe the hard drive and install Windows 10, will everything work correctly again?