CDS - Underlying vs Contract - Hazard rates

In the curriculum, in Credit Default Swap chapter, they walk you through how to calculate expected loss with hazard rates.

However, I am really mixed up as to :

The loss to take in account is :

  • the value of coupon (underlying)

  • the coupon on the CDS contract

I have seen a few questions where they give info about the underlying but actually don’t use them (example Finquiz mock 6 (am) questions 55-60).

Thanks in advance !

It would be better if you give concrete example but generally speaking the probability of default (=hazard rate) and the loss given default refer to the underlying.