  Previous luminescence and absorption experiments in Co-doped ZnO revealed two
ionization and one intrashell transition of $d(\textrm{Co}^{2+})$ electrons.
Those optical properties are analyzed within the generalized gradient
approximation to the density functional theory. The two ionization channels
involve electron excitations from the two $\textrm{Co}^{2+}$ gap states, the
$t_{2\uparrow}$ triplet and the $e_{2\downarrow}$ doublet, to the conduction
band. The third possible ionization channel, in which an electron is excited
from the valence band to the $\textrm{Co}^{2+}$ level, requires energy in
excess of 4~eV, and cannot lead to absorption below the ZnO band gap, contrary
to earlier suggestions. We also consider two recombination channels, the direct
recombination and a two-step process, in which a photoelectron is captured by
$\textrm{Co}^{3+}$ and then recombines via the internal transition. Finally,
the observed increase the band gap with the Co concentration is well reproduced
by theory.
  The accurate description of ZnO:Co is achieved after including $+U$
corrections to the relevant orbitals of Zn, O, and Co. The $+U(\textrm{Co})$
value was calculated by the linear response approach, and independently was
obtained by fitting the calculated transition energies to the optical data. The
respective values, 3.4 and 3.0~eV, agree well. Ionization of Co induces large
energy shifts of the gap levels, driven by the varying Coulomb coupling between
the $d(\textrm{Co})$ electrons, and by large lattice relaxations around Co
ions. In turn, over $\sim 1$~eV changes of $\textrm{Co}^{2+}$ levels induced by
the internal transition are mainly caused by the occupation-dependent
$U(\textrm{Co})$ corrections.
