Israel must not relent from elimnating Hamas from Gaza. Victory is militarily possible because Gaza can be blockaded, isolated and surrounded. To allow Hamas to survive will only strengthen it in the long run. Whether Israel can and will do so remains to be seen. Powerline has addition thoughts.
Once Hamas is destroyed Israel must remain and occupy Gaza (as the US did with Iraq). Israel must help the surviving Palestinians rebuild its governmental and social infrastructure. Since The Palestinians have suffered from the inept management under Hamas, there is a sliver of a chance once Hamas is gone, and with Israeli help, Gaza can be rebuilt as a future politically and economically viable Palestinian state. Israel must not give Gaza to Fatah. Fatah is thoroughly corrupt and corruption is the death of any political society. Fortunately there aren't much Fatah left in Gaza thanks to Hamas.
The best chance for a viable Palestinian state is the eradication of Hamas from Gaza.