Unfortunately there are a lot of possibilities here, which translates as a lot of input boxes (the red carded player position, the score, possibly the time, and the position to sub in), which surely translates to a lot of programming (work). You'd need alternatives for each position and each side, which gets pretty complicated. Here's the simplest way I can think of it could work.
At the very least, there should be options to sub out an attacking player for a defensive one (assuming at least one transfer remains) after (or once) a red card is given to a defensive player when any of the following occur:
-Goal difference (GD) drops by 2 (from when red card was given). e.g. you're winning 3-0, a red card is given, and the opposition scores 2 unanswered goals
-GD is zero (game is tied)
-GD is negative (opposition is winning)
-a second red card is given (unlikely but possible)...maybe this should be automatic for everyone.
Managers could simply select any or all of these options, and the most appropriate player (position proficiency and value x % condition) would automatically be subbed in, and the weakest central? attacking player (lowest [value x % condition] FC or AMC if you're playing with 2) would come off.
There should also be a special case for when you have a player that is proficient as both an attacking and defending player. Then you could opt to simply shift the player from the attacking position to the defending one when any of the above cases happen, rather than wasting a sub. Oops, now I making it even more complex. Better quit while I'm ahead.