import 'package:flutter/foundation.dart';

import '../constants/app_constants.dart';

class AdHelper {
  static bool get isMobilePlatform {
    if (kIsWeb) return false;
    return defaultTargetPlatform == TargetPlatform.android ||
        defaultTargetPlatform == TargetPlatform.iOS;
  }

  static String get interstitialAdUnitId {
    if (!isMobilePlatform) {
      throw UnsupportedError('Interstitial ads are only supported on mobile.');
    }
    return AppConstants.interstitialAdUnitId;
  }

  static String get nativeAdUnitId {
    if (!isMobilePlatform) {
      throw UnsupportedError('Native ads are only supported on mobile.');
    }

    final isIOS = defaultTargetPlatform == TargetPlatform.iOS;
    if (isIOS) {
      if (kDebugMode) {
        return AppConstants.testIosNativeAdUnitId;
      }
      return AppConstants.iosNativeAdUnitId;
    }

    // Android는 디버그/릴리즈 모두 실제 광고 단위 ID 사용
    return AppConstants.androidNativeAdUnitId;
  }
}
