Gauge models of topological phases and applications to quantum gravity