Changing light states, according to cycle, on and off

Hi,

In my kitchen I have five lights, that I would like to control with one button. The lights could be considered four diffent groups, one with all, and then three with different or different combinations, like A+B, A+B+C, A+D+E (so all would then be either a fourth group with A+B+C+D+E or a group with all the other groups in it.
Double click the button (card) would turn off all lights in the room.
Single press would switch from the current group of lights to the next. So, if all lights in the room where off it would turn on the lights in the first group, if pressed again, it would turn off the lights that wheren’t in the second group and then turn on lights in second group, aso.

The selected, or last used group, should of course be used so that if double clicked and single pressed, the same group should be turned on again.

I’ve experimented with various versions of scripts and automations, using an input_select to keep of the current group, but it just becomes cluttered and really unmanageable.

Anyone having a good idea on how to approach this?

Thanks in advance!