Ireland beat defending champions Afghanistan by 122 runs to win the ICC Intercontinental Cup final in Dubai.