MacBook Pro 2019 reset to factory: Mojave or Catalina?
See Apple's documentation on Recovery Mode on ways to reinstall macOS and/or erase the disk. A simple reinstallation should not impact installed applications or user data, but as usual making a backup before is recommended. Also, downgrading from Catalina to Mojave always require changes in the disk format/partitions so you must make a backup before.
Which version of macOS is installed during Recovery can be partially influenced by the way Recovery Mode is launched (see https://support.apple.com/kb/HT204904):
- Cmd-R reinstalls the same version as currently installed
- Opt-Cmd-R installs the newest version available
- Shift-Opt-Cmd-R installs the version the Mac shipped with (or the oldest one still available if the shipped version isn't available any longer)
If you clean install macOS, you will "wipe out" any FileVault encryption so whether you have the key or not is rendered moot. The boot firmware password, however, is not affected.