The UN Security Council has adopted a resolution aimed at reaching a comprehensive ceasefire deal in three phases to end the war in Gaza.