Need help with light and hood in toilet

Help me with automation in esphome.
There is a toilet with a light and a hood in it.
Task: when the button is pressed once, only the light turns on, when it is pressed again, light turns off. With a long press, the light and hood turn on, with a short press, the light turns off, the hood works for another N minutes.

very difficult to understand without the initial code

By “hood” do you mean “extractor fan”?

Yes, I mean extractor fan.