Modelling perception as a hierarchical competition differentiates imagined, veridical, and hallucinated percepts