How does Diviner Wizard’s Portent work with bonuses/penalties? [duplicate]

I’ve been trying to find the answer to this question, but haven’t been able to find it yet, as I seem to find conflicting answers online.

The description of Portent is as follows:

When you finish a long rest, roll two d20s and record the numbers rolled. You can replace any attack roll, saving throw, or ability check made by you or a creature that you can see with one of these foretelling rolls. You must choose to do so before the roll, and you can replace a roll in this way only once per turn. Each roll can only be used once.

My group has been having some questions:

  • An enemy has to roll 1d20 + 5 for an ability check. The wizard uses portent to replace the ability check with 2. Does the enemy still add +5 (2+5 = 7)? The Portent text doesn’t mention it only replaces the roll, but the "ability check", so we’re unsure if only the die is changed, or the entire check.
  • An ally would roll for an attack roll, but the wizard replaces it to 20 with Portent. Is that considered a critical hit and roll critical damage as appropriate? (same for replacing an enemy roll with 1.
  • A character would roll with disadvantage/advantage. The wizard uses Portent. Does the character still roll one die, and check for advantage/disadvantage (higher/smaller between his roll and the Portent number), or the check itself is replaced in it’s entirety, no need to roll the second die?

So, it’s three questions:

  • Do bonuses (+/- to roll) apply to the Portent chosen number?
  • Does critical success/failure apply to the Portent chosen number?
  • Does Portent both rolls in the case of advantage/disadvantage rolls?

As we understand, the die is never really rolled, as it’s result is defined by the Wizard in the foretelling. So far, we’ve been considering if the Portent roll was 8, then no bonuses are applied at all, no advantage/disadvantage second die is rolled, and the result is just a flat 8.