Using the automation editor it will help somewhat step you thru making an automation for this. I’m sure that can be done. Also having someone or something writing it for you means the second it misbehaves, you will be struggling back to find someone to fix it for you.
The best way to learn is to just try. Run thru the docs on getting started with the automation editor. If you get stuck, come back with what you have done. Understanding automations - Home Assistant and The Home Assistant Cookbook - Index.
Also I have a Blueprint that does most of what you want. That might work for you. You might have to ‘take control’ of it, then change some of the actions to control lights.