If you or a loved one is (or has become) incapacitated, the doctor will ask a representative to make decisions. If you have not appointed anyone, a family member is the legal representative. This can be a spouse, a parent, or a child. Sometimes it is difficult to determine whether someone is incapacitated. Then the help of a specialized and independent doctor can be sought.
Your representative must act in your best interest and take your wishes into account as much as possible. As long as that is at all possible, the representative should consult with you.
When someone is in a coma, unconscious, has a severe intellectual disability or advanced dementia, they cannot decide for themselves. However, there are also conditions where this is less clear, e.g. in the case of a psychiatric disorder, a mild intellectual disability, non-congenital brain injury or early dementia. It can also vary depending on the situation. For example, you may be temporarily incapacitated due to grief, illness or medication.
Everyone is legally competent (and therefore allowed to decide for themselves), unless proven otherwise. You can also be competent for one situation and not for another. Whether someone is incapacitated is therefore assessed on a decision-by-decision basis.