After months of negotiations, Israel and Hamas have agreed on the terms of a ceasefire that could end the war in Gaza. If the deal is implemented, dozens of hostages held by Hamas and hundreds of Palestinians detained in Israeli jails would be released.