Local electronic structure and luminescence properties of Er doped ZnO nanowires