Cut out completely on 2003 Buick Century

Rookie cbe0621eac06868b3efe0d8d1d3611e23c60d3114864ea2ec19a68cfbd3eebab
all inside lights went off, engine stopped immediately, car has automtic door locks that click after you start up and locks you safely in the car, but when everything went off, I was locked in the car and couldn't get out, car would not start, nothing would work.
About twelve minutes later, everything popped back on; I'm still inside, but I had not done a thing (except to call for help on my cellphone). Could you possibly tell me what happened, and how to keep this from happening again in the future? What if there had been an engine fire? The car was not hot. I had been shopping in WalMart, and had just pulled out of the parking lot onto a side street.
(1) Answer
You need to go out to the battery. Disconnect the negative cable first then the positive next. You need to take off the rubber that hides all that corrision, especially the positive cable, and clean all that green stuff off the cable ends. You have a bad connection at the battery.