Yeah, it's been pretty clear this operation was not something they cobbled together in an afternoon.
Now what has got me wondering is that they had to know what Israel's reaction was going to be so do they have a phase 2 waiting in the wings? I find it hard to believe that with all the time and care they took in planning this that their plan was to just kill some civilians and take hostages thus triggering a reaction from Israel and then just run back to Gaza to hide and wait. What have they got waiting ?
They are going to attempt to draw the IDF into a protracted urban engagement that will go a long way towards nullifying the IDF's advantages in armor and air power. If they can tie down a bunch of the IDF and deny them the ability to maneuver, ideally in close terrain that counters the IDF's sensor superiority they can inflict quite a bit of damage with infantry, light weapons and IEDs. They are also doing it on their home field, where they've had plenty of time to prep the battlefield, build defenses and choke points, and plan ambushes.
On the Strategic front if they get the IDF to engage in Gaza, and kill a bunch of non-combatants (say non-combatants that were prevented from leaving by VBIED attacks at border chokepoints) they think they it's likely they can draw other Arab countries into the war, giving the Palestinians enough allies to defeat Israel, and take a good portion of the Southern Israel to make a new country.
ETA For some perspective: The Second battle of Fallujah is a decent corollary. It was an Urban battle between a modern technological force vs. a much lighter equipped force of irregulars (armed by Iran) in a city the insurgents had had time to prepare defenses in. It's obviously much smaller. Fallujah is 25 sqkm, where as Gaza City alone is 45 sqkm and the whole Strip is 365 sqkm. Fallujah took 13,000 Coalition troops two weeks to mostly secure, and another month after that to actually secure, against ~4500 insurgents. We could also effect a 100% blockade of Fallujah, where as Gaza has a coast and an Egyptian border that is much harder to close. Hamas has, at best estimate, 30,000-40,000 fighters in Gaza, and a metric shitton of explosives and small arms. The IDF has a bit under 200,000 active forces, and a bit under 500,000 Reservists. Hamas thinks they can lure the IDF into a big enough incursion that they can pin down and destroy a good portion of it in the favorable terrain.