Insomnia has been typically considered a dysfunction of sleep regardless of other health
conditions.
However, it has recently been redefined to reflect the fact that it is normally related to other medical disorders.
While it can still be a stand-alone diagnosis, recent changes to the International Classification of Sleep Disorders - Third Edition (ICSD-3) have limited the definition, so it is more likely to be considered a symptom as opposed to a single primary diagnosis.