There's also now a Varlink based API to query the current factory reset state (i.e. is a factory reset pending for the next reboot, or are we currently executing one for the current boot, or did we already finish one for the current boot, or is none pending nor executing).
If you want to learn more about the factory reset concepts in systemd, there is a new document for this:
https://github.com/systemd/systemd/blob/main/docs/FACTORY_RESET.md