Synthesis and characterization of Mg-doped ZnO thin-films for photovoltaic applications