An ab initio investigation on the electronic structure, defect energetics, and magnesium kinetics in Mg3Bi2