Preserving an iPhone in factory state for long term
One of the primary things you need to be concerned about is battery. As you wish to maintain the device in a usable state, it's recommended to keep the battery in as healthy state as possible. Refer to the Apples's webpage dedicated to Batteries here and follow the recommended storage guidelines:

https://www.apple.com/in/batteries/

Specifically:
From, https://www.apple.com/in/batteries/maximizing-performance/

Avoid extreme ambient temperatures
Your device is designed to perform well in a wide range of ambient temperatures, with 16° to 22° C (62° to 72° F) as the ideal comfort zone.

Even when storing, make sure to keep the device in the given temperature range.

Store it half-charged when you store it long term
If you want to store your device long term, two key factors will affect the overall health of your battery: the environmental temperature and the percentage of charge on the battery when it’s powered down for storage. Therefore, we recommend the following:

Do not fully charge or fully discharge your device’s battery — charge it to around 50 per cent. If you store a device when its battery is fully discharged, the battery could fall into a deep discharge state, which renders it incapable of holding a charge. Conversely, if you store it fully charged for an extended period of time, the battery may lose some capacity, leading to shorter battery life.

Power down the device to avoid additional battery use.

Place your device in a cool, moisture-free environment that’s less than 32° C (90° F).

If you plan to store your device for longer than six months, charge it to 50 per cent every six months.


Depending on how long you store your device, it may be in a low-battery state when you remove it from long-term storage. After it’s removed from storage, it may require 20 minutes of charging with the original adapter before you can use it.

The website also recommends to update your device to the latest available version of iOS to benefit from software optimizations. However, if you wish to preserve the factory installed version of iOS, refrain from upgrading the iOS (which can be ensured by not letting the device connect to data network).

For my own devices that I have stored for long term, I generally power them on once every couple months and make sure to keep the battery charge at recommended 50%.
It would be a good idea to fully charge, then discharge, then charge the battery to 50% to store it again for long term. This would ensure that the electrons get a chance to move.