My name is Roger and I will do my best to help you with this problem.
This problem can range from simple to complex. It may be that the battery had just enough of a surface charge to allow you to open the vehicle or you may have experienced a problem with the vehicle's power supply at the fuse panel known as the junction box.
The first thing to do would be to try and jump the vehicle under the hood or try to charge the battery. If this does restore power then the first step would be to inspect the battery terminals and if the battery is original then start with a battery replacement.
If using an external power supply like jumping the vehicle does not restore power then you may have an issue with the junction box. There is a known issue with the power supply cable to the junction box that can fail causing a loss of electrical power. The cable is on the back of the fuse panel and it needs to be disassembled to check. This type of repair would be best done by the dealer or your repair shop as the removal is on the complex side. They would need to look for any discoloration of the power cable or if the cable cannot be removed due to it being melted to the fuse panel. The fix would be to replace the end of the power cable plus replacement of the fuse panel.
I hope this information proves helpful. Let me know if I can help further. Please remember to provide positive feedback once satisfied with my assistance.