import 'gravity_engine_method_channel.dart';
import 'gravity_engine_platform_interface.dart';

class GravityEngine {
  GravityEngine._();

  static Future<bool> initialize(String appId, String accessToken,
      String clientId, String channel, bool debug) {
    return GravityEnginePlatform.instance
        .initialize(appId, accessToken, clientId, channel, debug);
  }

  static Future<void> trackEvent(String eventName,
      {Map<String, dynamic>? eventProperties}) {
    return GravityEnginePlatform.instance
        .trackEvent(eventName, eventProperties: eventProperties);
  }

  static Future<void> trackPay(String orderNo, String itemName, int amountCent,
      String currency, PayType payType) {
    return GravityEnginePlatform.instance
        .trackPay(orderNo, itemName, amountCent, currency, payType);
  }

  static Future<void> trackAdLoadEvent(
      String? adUnionType,
      String? adPlacementId,
      String? adSourceId,
      String? adType,
      String? adnType) {
    return GravityEnginePlatform.instance.trackAdLoadEvent(
        adUnionType, adPlacementId, adSourceId, adType, adnType);
  }

  static Future<void> trackAdShowEvent(
      String? adUnionType,
      String? adPlacementId,
      String? adSourceId,
      String? adType,
      String? adnType,
      double? ecpm) {
    return GravityEnginePlatform.instance.trackAdShowEvent(
        adUnionType, adPlacementId, adSourceId, adType, adnType, ecpm);
  }

  static Future<void> trackAdClickEvent(
      String? adUnionType,
      String? adPlacementId,
      String? adSourceId,
      String? adType,
      String? adnType,
      double? ecpm) {
    return GravityEnginePlatform.instance.trackAdClickEvent(
        adUnionType, adPlacementId, adSourceId, adType, adnType, ecpm);
  }

  static Future<void> trackAdPlayStartEvent(
      String? adUnionType,
      String? adPlacementId,
      String? adSourceId,
      String? adType,
      String? adnType,
      double? ecpm) {
    return GravityEnginePlatform.instance.trackAdPlayStartEvent(
        adUnionType, adPlacementId, adSourceId, adType, adnType, ecpm);
  }

  static Future<void> trackAdPlayEndEvent(
      String? adUnionType,
      String? adPlacementId,
      String? adSourceId,
      String? adType,
      String? adnType,
      double? ecpm,
      int? duration,
      bool? isPlayOver) {
    return GravityEnginePlatform.instance.trackAdPlayEndEvent(adUnionType,
        adPlacementId, adSourceId, adType, adnType, ecpm, duration, isPlayOver);
  }

  static Future<void> login(String clientId) {
    return GravityEnginePlatform.instance.login(clientId);
  }

  static Future<void> logout() {
    return GravityEnginePlatform.instance.logout();
  }
}
