The deal was reached after a weekend of negotiations in Switzerland.