Here,it is like this.
HP is "Hit Points" and that is how much hits it can take.Therefore it is stamina.But it is also energy.When you run out of HP,your pokemon faints.Therefore it is also energy.It is like life.HP is just like life,and health.Health is how good you are feeling.If you have good health you are strong and not weak.But if you have bad health,then you're weak.
HP is more of energy though.The stats Defense and Sp.Defense are stamina.They are that because the higher the Defense/Sp.Defense,you can resist attacks more.Therefore HP is really more of energy.No energy means fainting.The green/yellow/red bar is how much energy of your pokemon is remaining.The other portion is how much is lost.Like Nintendork15 said,resting makes energy go back up and healed.
So,the answer is that HP is just energy in numbers.
Now the real question is,how do sprays heal energy?
That can also be answered.The HP bar also resembles how much more damage it can take before it faints.Now,this does NOT mean that HP is stamina.When it says that on Bulbapedia,it means that when damage is taken,you lose energy.Stamina is how much damage can be RESISTED.The previous paragraph supports this answer on how Defense and Sp.Defense is stamina.
Anyways,sprays will help pokemon regain energy by spraying on the wounds and scars.It is like alcohol or medicine in the form of a spray.When the wounds are gone,pokemon are healed and ready to battle.
So we have many conclusions here.Let me list them down.
1.HP resembles energy NOT Stamina.
2.To further support 1,Defense and Sp.Defense resembles Stamina.
3.Stamina is how much damage can be resisted NOT how much damage can be recieved.
Thank you for reading this "essay" and hope you like reading people write many many things in a forum post.