Qudit surface codes and gauge theory with finite cyclic groups