// import 'package:facebook_app_events/facebook_app_events.dart';
import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'events_constants.dart';
import 'package:flutter/widgets.dart';

typedef EventHook = void Function(String name, Map<String, dynamic> parameters);

class EventTransmitter {
  final Map<String, EventHook> hooks;
  final EventHook? defaultHook;

  EventTransmitter(this.hooks, {this.defaultHook});

  void transmit(String name, Map<String, dynamic> parameters) {
    if (hooks.isNotEmpty == true) {
      final hook = hooks[name] ?? defaultHook;
      hook?.call(name, parameters);
    } else {
      defaultHook?.call(name, parameters);
    }
  }
}