I’m not sure if this will work for you, but it should get you going in the right direction.
Your going to need to create an action to update the ticket properties:

Then create 2 rules, Here is a screen shot of the first:

The 2nd rule should be the opposite.
Again, I’m not sure if this will work for you, but hopefully get you going in the right direction.