The x-ray photoelectron spectra of metal halides and their complexes: halogen binding energies and their correlation with structure