Armenia and Azerbaijan have reportedly agreed on the terms of a historic peace deal, after over three decades of bitter conflict.