WASHINGTON – President Donald Trump warned that he's "totally prepared for a very long shutdown," but just how long it takes to break the impasse and reopen agencies will depend on who blinks first and the creaky mechanics of Congress.

Trump and congressional leaders could technically strike an agreement and move emergency legislation through the Capitol quickly, reopening agencies in under an hour. But the entrenched battle over Trump's proposed wall along the U.S.-Mexico border – not to mention the Christmas holiday – may hamper a speedy resolution.

There are two hurdles in front of the off ramp. First, Trump and Democratic Senate leaders must come to an agreement that can also pass the GOP-led House. Once an agreement is reached, leaders may have to call lawmakers back to Washington, endure procedural delays in the Senate and get the bill to the president for his signature.

Here's a look at some possible scenarios for ending the shutdown:

Speedy agreement

Of the 14 government shutdowns that have occurred since the beginning of the Reagan administration, most were resolved in a few days. For now, Trump has delayed the start of his annual winter trip to Florida and most members of Congress are expected to stay close to Washington. If leaders reach a deal, it would likely need to clear the Senate first and then pass the House.

More:A look at what public services will – and won’t – be interrupted in a shutdown

If no single senator stands in the way of the agreement, the deal could move through Congress quickly. Agencies could resume operations once Trump signs the bill, potentially resolving the shutdown just hours after it began.

Alternatively, Congress could quickly pass a short-term spending bill while the broader agreement is drafted and winds its way through procedural hurdles. For government workers nervous about paychecks, this would be the best-case scenario.

Mr. Smith steals Christmas

Any single senator can stand in the way of an agreement that the president and most other members support, a dynamic that would require Senate Majority Leader Mitch McConnell to file a cloture motion to cut off debate. An intervening day must pass before the Senate can vote on that motion, which then requires 60 votes to pass.

The Senate would then wait as long as 30 hours before voting on the actual legislation, though that window is routinely shortened.

If handled by the book, the Senate's procedures could put a bill back on the House floor around Christmas, when lawmakers could be home for the holiday. House leaders are struggling to keep members who have been voted out of office in town for votes.

Under this scenario, it would take a few days to resolve the shutdown but it's not likely that many Americans would notice. Christmas is a federal holiday, so non-essential government operations would already be shuttered on that day. Trump signed an executive order this week giving most federal workers the day off for Christmas Eve.

Dems circle Jan. 3

Trump is frustrated with Democratic opposition to his proposed border wall now, but he's in for a much rougher ride come Jan. 3. That's the day Democrats will take control of the House, a dynamic that will significantly weaken his negotiating position.

Democrats could block action in the Senate until early January when they will have a stronger hand. If his party sticks together, Senate Minority Leader Chuck Schumer, D-N.Y., could resist offers Trump and Senate Republicans put on the table until the new year. In other words, just wait it out. In that case, lawmakers would likely head home for Christmas and Trump could fly to his Palm Beach resort, Mar-a-Lago.

But that strategy comes with a big political risk: More voters could be affected by a shutdown the longer it continues. If voters perceive either side is delaying action unnecessarily, the approach could backfire in the 2020 election.

When will it end?

As Trump suggested, a long shutdown is possible given the stakes. Trump ran for president on a promise to build the wall, and conservatives will blame him if he doesn't deliver. Democrats are ardently opposed to the wall – which they note Trump said would be paid for by Mexico – and want to extract concessions before giving an inch.

Early Saturday morning, Trump tweeted that “we are negotiating with the Democrats on desperately needed Border Security (Gangs, Drugs, Human Trafficking & more) but it could be a long stay.”

The longest government shutdown, which took place in late 1995 and early 1996, lasted 21 days. Washington allowed the government to shut down for 16 days in 2013.

Democrats can already block a funding bill indefinitely in the Senate, forcing Trump to either capitulate or hold his ground. Democratic power will only grow on Jan. 3, when House Minority Leader Nancy Pelosi is expected to become the next House Speaker. It's easy to see how the scenario begins, but more difficult to predict how it ends. The conclusion would likely be driven by polls that show who voters blame more.