// import 'package:facebook_app_events/facebook_app_events.dart';

class Method {
  static const initialize = "initialize";
  static const getAppInstanceId = "getAppInstanceId";
  static const logEvent = "logEvent";
  static const setUserProperty = "setUserProperty";
  static const setDeviceId = "setDeviceId";
  static const setUid = "setUid";
  static const setAdjustId = "setAdjustId";
  static const setAdId = "setAdId";
  static const setFirebaseId = "setFirebaseId";
  static const setScreen = "setScreen";
  static const zipLogs = "zipLogs";
  static const getStatistic = "getStatistic";
  static const onAnalyticsCallback = "onAnalyticsCallback";
  static const setConsents = "setConsents";
}

class FieldName {
  static const batchLimit = "batchLimit";
  static const uploadPeriodInSeconds = "uploadPeriodInSeconds";
  static const delayedInSeconds = "delayedInSeconds";
  static const eventExpiredInDays = "eventExpiredInDays";
  static const DEVICE_ID = "deviceId";
  static const USER_ID = "userId";
  static const ADJUST_ID = "adjustId";
  static const AD_ID = "adId";
  static const FIREBASE_ID = "firebaseId";
  static const EVENT_NAME = "eventName";
  static const PARAMETERS = "parameters";
  static const PRIORITY = "priority";
  static const ENABLED = "enabled";
  static const MILLISECONDS = "milliseconds";
  static const NAME = "name";
  static const VALUE = "value";
  static const SCREEN = "screen";
  static const DEBUG = "debug";
  static const X_APP_ID = "xAppId";
  static const X_DEVICE_INFO = "xDeviceInfo";
  static const EVENT_CODE = "code";
  static const EVENT_ERROR_INFO = "errorInfo";
}

class AdTypeName {
  static const String AD_TYPE_BANNER = "banner";
  static const String AD_TYPE_INTERSTITIAL = "interstitial";
  static const String AD_TYPE_REWARDED_VIDEO = "rewarded_video";
  static const String AD_TYPE_NATIVE = "native";
}

class FacebookAppEventsConstants {
  static const String EVENT_NAME_AD_CLICK = "AdClick";
  static const String EVENT_NAME_AD_IMPRESSION = "AdImpression";
  static const String EVENT_NAME_COMPLETED_TUTORIAL = "fb_mobile_tutorial_completion";
  static const String EVENT_NAME_SPENT_CREDITS = "fb_mobile_spent_credits";
  static const String EVENT_NAME_ACHIEVED_LEVEL = "fb_mobile_level_achieved";
  static const String EVENT_NAME_PURCHASED = "fb_mobile_purchase";
  static const String EVENT_NAME_ACHIEVEMENT_UNLOCKED = "fb_mobile_achievement_unlocked";
  static const String EVENT_NAME_RATE = "fb_mobile_rate";
  static const String EVENT_NAME_SEARCH = "fb_mobile_search";
  static const String EVENT_NAME_ADD_TO_WISHLIST = "fb_mobile_add_to_wishlist";
  static const String EVENT_NAME_ADD_TO_CART = "fb_mobile_add_to_cart";
  static const String EVENT_NAME_CONTENT_VIEW = "fb_mobile_content_view";

  static const String EVENT_PARAM_AD_TYPE = "ad_type";
  static const String EVENT_PARAM_CONTENT = "fb_content";
  static const String EVENT_PARAM_DESCRIPTION = "fb_description";
  static const String EVENT_PARAM_CONTENT_ID = "fb_content_id";
  static const String EVENT_PARAM_CONTENT_TYPE = "fb_content_type";
  static const String EVENT_PARAM_SEARCH_STRING = "fb_search_string";
  static const String EVENT_PARAM_MAX_RATING_VALUE = "fb_max_rating_value";
  static const String EVENT_PARAM_SUCCESS = "fb_success";
  static const String EVENT_PARAM_LEVEL = "fb_level";
  static const String EVENT_PARAM_CURRENCY = "fb_currency";
}

class FirebaseEventsParams {
  static const String AD_FORMAT = "ad_format";
  static const String AD_PLATFORM = "ad_platform";
  static const String AD_SOURCE = "ad_source";
  static const String AD_UNIT_NAME = "ad_unit_name";
  static const String CURRENCY = "currency";
  static const String VALUE = "value";

  /// Type of content selected.
  static const String CONTENT_TYPE = 'content_type';
  static const String ITEM_ID = 'item_id';
  static const String METHOD = 'method';
}

class AppEventCapabilities {
  static const int firebase = 0x01;
  static const int facebook = 0x02;
  static const int guru = 0x04;

  static const fullCapabilities = AppEventCapabilities(firebase | facebook | guru);
  static const firebaseCapabilities = AppEventCapabilities(firebase);
  static const facebookCapabilities = AppEventCapabilities(facebook);
  static const standardCapabilities = AppEventCapabilities(firebase | facebook);

  final int value;

  const AppEventCapabilities(this.value);

  bool hasCapability(int capability) {
    return (value & capability) == capability;
  }
}

typedef EventParamsConvertor = Map<String, dynamic> Function(Map<String, dynamic> parameters);

class AppEventOptions {
  final AppEventCapabilities? capabilities;
  final EventParamsConvertor? firebaseParamsConvertor;
  final EventParamsConvertor? facebookParamsConvertor;
  final EventParamsConvertor? guruParamsConvertor;
  final EventParamsConvertor? adjustParamsConvertor;

  AppEventOptions(
      {this.capabilities, this.firebaseParamsConvertor, this.facebookParamsConvertor, this.guruParamsConvertor, this.adjustParamsConvertor});
}