Photoelectrical detection of nitrogen-vacancy centers by utilizing diamond lateral p–i–n diodes