High-resolution x-ray spectroscopic study of the electronic structure of the prototypical p-type transparent conducting oxide CuAlO2