How to handle undefined targets in a composition based ability system?

Hey all,
I’m trying to code a composition based ability system for a turn-based game because im doing a game with a lot of different abilitys.

I have an AbilityController and an AbilityComponent. From those i plan to make all my abilitys. The Controller should just grab ALL Components attached to an ability and trigger them. The Components are something like DamageComponent, HealComponent, SpeedBuffComponent and so on.
Controller:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AbilityController : MonoBehaviour
{
    public void CastAbility()
    {
        AbilityComponent[] abilityComponents = gameObject.GetComponents<AbilityComponent>();
        for(int i = 0; i< abilityComponents.Length; i++)
        {
            abilityComponents*.CastAbilityComponent();*

}
}
}
Component:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AbilityComponent : MonoBehaviour
{
public void CastAbilityComponent()
{
//do stuff
}
}
Now i want to make a system where the targets could be different for each Component.
Example:
Damage Enemy A
Debuff Enemy A+B+C
Heal PlayerCharavter A+B+C
For this i would need 3 TargetArrays but i do not want to hardcode 3 different arrays. Not sure how to handle this problem.

You could define an interface called ITarget which is going to be implemented by all units (enemies or player). Then, your AbilityComponent should also receive a list of targets:

         public class AbilityComponent : MonoBehaviour
         {
             public void CastAbilityComponent(params ITarget[] targets)
             {
                 //do stuff
             }
         }

And now you can specify the targets that are going to be affected by each spell at runtime, without hardcoding anything

Okay, thank you for the answer. But how can i then specify which of the targets is healed and which damaged if my ability can do both for example?