We develop a model for the long-term dynamics of electricity market, based on mean-field games of optimal stopping. Our paper extends the recent contribution (Aïd et al., J. Dyn. Games 8(4):331, 2021) in several ways, making the model much more realistic, especially for describing the medium-term impacts of energy transition on electricity markets. In particular, we allow for an arbitrary number of technologies with endogenous fuel prices, introduce plant construction time and enable the agents to both invest and divest. This makes it possible to describe the role of gas generation as a medium-term substitute for coal, to be replaced by renewable generation in the long term, and enables us to model the events like the 2022 energy price crisis. This is a joint work with Roxana Dumitrescu and Peter Tankov.