Theory of doping and defects in III–V nitrides