The ugly stalemate between the San Diego Chargers and and Joey Bosa has finally come to an end. The Chargers announced on Monday that they've signed their third-overall pick to a four-year deal that will include a team option for a fifth year.

The signing ends a 31-day holdout that got testy last week after the Chargers publicly shamed Bosa during negotiations, claiming that he had turned down one of the best offers ever given to a rookie in San Diego.

Despite the acrimony, the two sides were able to hammer out a deal before the Chargers final preseason game, which means Bosa could be available for Thursday's game against the 49ers.

"We look forward to having Joey join us and getting him prepared as quickly as possible for the 2016 season," Chargers GM Tom Telesco said in a statement.

Bosa's four-year deal with the Chargers is worth $25.8 million and includes a $17 million signing bonus. Of course, due to the rookie slotting system, it's been known since April that Bosa's deal would be worth $25.8 million.

The holdup in negotiations was that Bosa wanted one of two things from the Chargers: He either wanted no offset language in his contract OR he wanted his entire signing bonus paid during the 2016 calendar year.

Offset language is important to a player because it potentially gives them the ability to be paid twice if they get cut. If Bosa were to be released in Year 4 of his deal and then sign with a new team, he would collect paychecks from both his new team and the Chargers, since his entire rookie deal is guaranteed.

If there is offset language in a contract, then the player can only collect a certain amount of money from the team that cut him if he signs with a new team. For instance, if Bosa was scheduled to make $5 million in the final of year of his deal, but got cut, and then signed by another team for $2 million, the Chargers would owe him $3 million and the new team would give him $2 million so he'd get the entire five millions. Without offset language, Bosa would collect $5 million from the Chargers AND $2 million from his new team.

On the Chargers end, they wanted Bosa's deal to include offsets and they wanted to defer part of his signing bonus to March 2017. That led to a stalemate that quickly turned into one of the ugliest rookie negotiations in recent NFL history.

According to ESPN.com, the Chargers got their wish with offset language, which was included in Bosa's deal. For Bosa, he received the largest upfront signing bonus in Chargers history.

Things got so ugly during Bosa's holdout that even his mom was blasting the Chargers. Back in early August, Cheryl Bosa said that she wished her son had pulled an "Eli Manning" on draft day. For those unfamiliar with that story, Manning said he would refuse to play for the Chargers if they selected him with the No. 1 overall pick in 2004.

Although the Chargers ended up selecting Manning, he never played for San Diego because he was traded to the Giants on draft day.

Anyway, when the Chargers took negotiations public last week, it ended up making both sides look bad. Many Chargers fans thought Bosa was being greedy because he was going to get the entire $17 million signing bonus in his contract whether it was paid out in 2016 or 2017.

On the other hand, many fans thought the Chargers were just being cheapskates due to the team's long history of dealing with rookie holdouts.

As things stand, Bosa will now have 13 days to get ready before the Chargers open up the regular season on Sept. 11 in Kansas City.

Bosa's holdout will go down as one of the longest in recent history for a top pick. Before this year, the longest holdout for a top-3 pick came in 2007 when JaMarcus Russell didn't sign with the Raiders until Sept. 12.