The agreement follows almost 14 months of fighting – but what are its terms and how was it arranged?