By Dieter Kurtenbach, The Mercury News (TNS)

The 49ers entered this weekend with nothing but good vibes after holding a news conference to announce quarterback Jimmy Garoppolo’s new five-year contract on Friday.

Well, those good vibes are gone. You can thank Reuben Foster for that.

And now 49ers head coach Kyle Shanahan and general manager John Lynch have a big decision to make. One that could contradict or bolster the duo’s “winning the right way” rhetoric.

Foster, the Niners’ prodigiously talented young linebacker, was booked into Santa Clara County jail Sunday on charges of domestic violence. On top of those domestic-violence allegations, Foster was also booked on suspicion of possessing an assault rifle.

As an isolated incident, this looks, bad — really bad — for Foster and the 49ers.

But it’s not an isolated incident.

This is Foster’s second arrest in a month — he was arrested in Alabama on Jan. 12 for marijuana possession — and his third off-field incident since being drafted by the 49ers last April. Add in his diluted drug test and his altercation with a hospital worker that led to him being sent home from last February’s NFL draft combine, and you can fairly say that Foster has exhibited a pattern of behavior well-deserving of serious scrutiny.

It’s a pattern of behavior, highlighted by his latest, and most serious incident, that could easily cost Foster his job with the 49ers.

Foster’s latest arrest is the 17th reported 49ers player arrest since 2012 — that’s the most arrests for any NFL team over that period of time.

Shanahan and Lynch were supposed to establish a new culture in Santa Clara — they said they were going to establish a new culture in Santa Clara. In their handling of the Foster situation, they now get a chance to show us if they’re up to that task.

The courts and the NFL will afford Foster due process and will punish the linebacker as they deem fit. (The NFL’s standard suspension for domestic violence is six games, which is outrageous, but a conversation for another day.)

You and I will pass our own, meaningless judgments of Foster’s actions, as well. (What the hell were you thinking, Reuben?)

But I’m most curious to see how the 49ers handle this situation in the coming days, weeks, and perhaps months.

The 49ers don’t have to wait for due process to play out. They can deem Foster to be not worth the trouble — not worthy of representing the 49ers — and cut him right now. That’s what the team did last April, when Shanahan and Lynch cut starting cornerback Tremaine Brock one day after he was arrested on domestic violence charges.

Using the Brock precedent, Foster should be out of a job Monday.

But here’s the thing: Brock didn’t have All-Pro potential.

Foster does.

Both Shanahan and Lynch have said that they want to treat every off-the-field incident as a separate, unique situation when it comes to determining punishment. But we also saw what they did with Brock.

The 49ers’ new leaders, whether they intended or not, drew a line in the sand 10 months ago with Brock.

Are they willing to draw a different line for Foster?

If so, what does that say?

We’re one year into Shanahan and Lynch’s tenure — it’s fair to say that the duo is still trying to establish a culture in Santa Clara.

And culture is a fickle thing — it takes a long time and a lot of work to establish something worthwhile, but it can take one person a few minutes to undo months or years of hard work.

The 49ers placed a big bet on Foster last April. It’s hard to say which red flag was brighter in the pre-draft process — his injury history or his negative off-the-field reputation — but the 49ers bet on both his prodigious talent and his character. This is Shanahan and Lynch’s guy, for better or for worse.

On the field, the 49ers’ decision to bring in Foster is already paying dividends. Foster struggled with injuries, but he was every bit the game-changing linebacker Shanahan and Lynch thought he could be. He’s disproving the critics who thought his injuries and lack of polish would make him a first-round bust.

But he’s proving the critics of his character correct. And, in turn, he’s making the 49ers organization look bad.

Last April, Lynch said this about Foster: “I would anticipate people maybe questioning some of his character, but I would tell you his character’s what drew us to him.”

Context is important — Lynch went on to rave about Foster’s positive attitude — and by all accounts, Foster is a model citizen inside the 49ers’ facility. Coaches like working with him and he’s been great with the media — even when the 49ers were 0-9, he was always flashing a smile and had a solid cheer about him.

But I bet Lynch wishes he could take that quote back today.

How Shanahan and Lynch handle Foster after Sunday will tell us a lot about these men and how they want to run their organization. It could go a long way to setting the culture of the team.

Great play or strong character — the 49ers’ brass says it wants all of its players to bring both to the table, but when it comes to Foster, it seems as if the 49ers are going to have to decide which of those two things matters more.