This is currently a researchable topic in neuroscience.
Actually its not about light sleep or deep sleep or resting.Neuroscience prefers to describe sleep in the context of the immunity into mainly two stages: REM(Rapid Eye movement)sleep and non-REM.
Every sleep cycle occurs broadly in the given stages:
wakefulness ->rest ->non REM->REM-> non REM/wakefulness
You see every stages has varying hours in total sleeping duration and is different at different ages.
The REM sleep is the also called paradoxical sleep because the EEG records are similar to that of wakefulness and it is during this stage that we dream.
It is actually this stage of sleep that is responsible for boosting immunity.That is why it has been experimentally determined in rats that when they are deprived of REM sleep continuously for a few days they die.
Like I said REM sleep is still under study and is a matter of greater reasearch.