Disable Screen Sleep IF ...

I have been trying to figure this one out and I can’t seem to find a way to do this but I’m going to throw it here just in case.

I want to disable device screen sleep if I am running app X and the power status is “charging”.

I have figured out the app Automation part, I have figured out how to get the status of the charge. I can’t for the life of me figure out how to disable sleep and put it all together.