Target cast if harmful, target of target otherwise

Hello,

I want to create a macro to use Power Word: Solace as much as I can. I feel that I can accomplish this by creating a macro to cast PW:Solace on my target if my target is harmful, and casting it on my target’s target if I’m targeting my teammate in arena.

Is this possible?

#showtooltip
/cast [@target,harm] Power Word: Solace; [@targettarget,harm] Power Word: Solace

this should work. I did a quick test with some random targeting a raid dummy and it worked.

https://warcraftpriests.com/macros#offensive