Yeah I use "hurt" as the variable where they can't get hurt if they're already hurt (and flashing). I do have the can_hit\can_be_hurt as a separate variable aswell cus while they're doing some attack moves they can't be hurt, but aren't hurt, as that's the variable that makes them flash.
For the cooldown I don't use alarms, I simply decrease the value of hurt a certain amount per frame, so say if you wanted hurt to last for half a second, you would decrease the value by 1 / 30 each step, (assuming the game is 60 fps) Then ask if hurt <= 0.
You can do the same thing with alarms but I feel like it's adding extra things that make it more complicated, I like just dealing with all of it in code without having to remember different events that're involved