Microscopic Description of 2D Topological Phases, Duality, and 3D State Sums