/** Un aviso a un destinatario. Se crea con el static factory method of. */
public interface Notification {
    String send();

    /** Factory: la decisión de qué clase concreta crear está en este único lugar. */
    static Notification of(String channel, String to, String text) {
        return switch (channel) {
            case "email" -> new EmailNotification(to, text);
            case "sms" -> new SmsNotification(to, text);
            default -> throw new IllegalArgumentException("canal desconocido: " + channel);
        };
    }
}
