// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'test_guru_app_creator.dart';

// **************************************************************************
// GuruSpecGenerator
// **************************************************************************

class _Guru_testRemoteConfigConstants {
  static const iadsConfig = 'iads_config';

  static const radsConfig = 'rads_config';

  static const badsConfig = 'bads_config';

  static const analyticsConfig = 'analytics_config';

  static const Map<String, dynamic> _defaultConfigs = {
    iadsConfig:
        '{"free_s":600,"win_count":4,"scene":"game_start","sp_scene":"new_block:120;reset_scs:120","retry_min_s":10,"retry_max_s":600,"amazon_enable":false,"imp_gap_s":120}',
    radsConfig: '{"win_count":3}',
    badsConfig: '{"free_s":180,"win_count":1}',
    analyticsConfig: '{"cap":"firebase|facebook|guru", "init_delay_s": 10}',
  };

  static String getDefaultConfigString(String key) => _defaultConfigs[key];

  static String getKey(String key) => key;
}

class _Guru_testAppSpec extends AppSpec {
  _Guru_testAppSpec._();

  static final _instance = _Guru_testAppSpec._();

  @override
  final appName = 'GuruApp';

  @override
  final appCategory = AppCategory.app;

  @override
  final flavor = 'guru_test';

  @override
  final details = AppDetails(
    saasAppId: 'guruapp',
    authority: 'demo.gurugame.fun',
    storagePrefix:
        'https://firebasestorage.googleapis.com/v0/b/example.appspot.com/o',
    defaultCdnPrefix: 'https://cdn1.example.gurugame.fun',
    androidGooglePlayUrl:
        'https://play.google.com/store/apps/details?id=app_package_id',
    policyUrl: 'https://solitaire.fungame.studio/policy.html',
    termsUrl: 'https://solitaire.fungame.studio/termsofservice.html',
    emailUrl: 'demo@gurugame.fun',
    packageName: 'guru.app.demo',
    bundleId: 'guru.app.demo',
    facebookAppId: '123456789',
  );

  @override
  final deployment = Deployment(
    propertyCacheSize: 512,
    enableDithering: false,
    disableRewardsAds: true,
    enableAnalyticsStatistic: true,
    autoRestoreIap: false,
    igcBalanceSecret: 2654404609,
    initIgc: 500,
    autoRequestNotificationPermission: false,
    logFileSizeLimit: 10485760,
    logFileCount: 7,
    persistentLogLevel: 1,
    iosValidateReceiptPassword: 'aa998877665544332211bb00cc',
    conversionEvents: {
      'first_rads_rewarded',
      'level_end_success_1',
      'level_end_success_6',
      'level_end_success_10',
      'level_end_success_12',
      'level_end_success_15',
      'level_up',
      'level_up_1',
      'level_up_3',
      'level_up_5',
      'level_up_7',
      'level_up_10',
      'level_up_12',
      'level_up_15',
      'tch_ad_rev_roas_001',
      'tutorial_complete',
    },
    apiConnectTimeout: 15000,
    apiReceiveTimeout: 15000,
    iosSandboxSubsRenewalSpeed: 2,
    adsCompliantInitialization: false,
    notificationPermissionPromptTrigger: PromptTrigger.rationale,
    trackingNotificationPermissionPass: false,
    trackingNotificationPermissionPassLimitTimes: 10,
    allowInterstitialAsAlternativeReward: false,
    showInternalAdsWhenBannerUnavailable: true,
    subscriptionRestoreGraceCount: 3,
    fullscreenAdsMinInterval: 60,
    enabledSyncAccountProfile: false,
  );

  @override
  final adsProfile = AdsProfile(
      bannerId:
          const AdUnitId(android: 'xxxxxxxxxxxxxxxx', ios: 'xxxxxxxxxxxxxxxx'),
      interstitialId:
          const AdUnitId(android: 'xxxxxxxxxxxxxxxx', ios: 'xxxxxxxxxxxxxxxx'),
      rewardsId:
          const AdUnitId(android: 'xxxxxxxxxxxxxxxx', ios: 'xxxxxxxxxxxxxxxx'),
      amazonAppId: const AdAppId(
          android: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
          ios: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'),
      amazonBannerSlotId: const AdSlotId(
          android: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
          ios: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'),
      amazonInterstitialSlotId: const AdSlotId(
          android: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
          ios: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'),
      amazonRewardedSlotId: const AdSlotId(
          android: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
          ios: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'),
      pubmaticAppStoreUrl: Platform.isAndroid
          ? 'https://play.google.com/store/apps/details?id=app_package_id'
          : '');

  @override
  final productProfile = ProductProfile(
    oneOffChargeIapIds: _Guru_testProducts.oneOffChargeIapIds,
    subscriptionsIapIds: _Guru_testProducts.subscriptionsIapIds,
    pointsIapIds: _Guru_testProducts.pointsIapIds,
    rewardIds: _Guru_testProducts.rewardIds,
    igcIds: _Guru_testProducts.igcIds,
    groupMap: _Guru_testProducts.groupMap,
    manifestBuilders: _Guru_testProducts.manifestBuilders,
    noAdsCapIds: _Guru_testProducts.noAdsCapIds,
  );

  @override
  final adjustProfile = AdjustProfile(
      appToken: Platform.isAndroid ? 'testapptoken' : 'testapptoken',
      eventNameMapping: Platform.isAndroid
          ? <String, AdjustEventConverter>{
              "level_start": (_) => AdjustEvent("hq0xzz"),
              "iap_purchase": (params) =>
                  AdjustProfile.createAdjustEvent("yzy3uh", params),
              "sub_purchase": (params) =>
                  AdjustProfile.createAdjustEvent("yzy3uh", params),
              "level_end": (_) => AdjustEvent("so63k4"),
              "tutorial_complete": (_) => AdjustEvent("95fu7q"),
            }
          : <String, AdjustEventConverter>{
              "level_start": (_) => AdjustEvent("b8khry"),
              "iap_purchase": (params) =>
                  AdjustProfile.createAdjustEvent("z0gje7", params),
              "sub_purchase": (params) =>
                  AdjustProfile.createAdjustEvent("z0gje7", params),
              "level_end": (_) => AdjustEvent("1p8z5t"),
              "tutorial_complete": (_) => AdjustEvent("1p8z5t"),
            });

  @override
  final defaultRemoteConfig = _Guru_testRemoteConfigConstants._defaultConfigs;

  @override
  final localABTestExperiments = _GuruTestABTestExperiments.experiments;

  @override
  String getRemoteConfigKey(String key) =>
      _Guru_testRemoteConfigConstants.getKey(key);
}

class _Guru_testProducts {
  static final themeRegExp = RegExp(r"^theme_(.*)$");

  static final propRegExp = RegExp(r"^theme_(.*)_(.*)$");

  static const noAds = ProductId(
      android: 'so.a.iap.noads.699',
      ios: 'so.i.iap.noads.699',
      attr: TransactionAttributes.asset,
      points: false);

  static const noAdsCoinBundle = ProductId(
      android: 'so.a.iap.noads.coin.799',
      ios: 'so.i.iap.noads.coin.799',
      attr: TransactionAttributes.asset,
      points: false);

  static const noAds2 = ProductId(
      android: 'so.a.iap.noads.699',
      ios: 'so.i.iap.noads.699',
      attr: TransactionAttributes.possessive,
      points: false);

  static const coin200 = ProductId(
      android: 'so.a.iapc.coin.200',
      ios: 'so.i.iapc.coin.200',
      attr: TransactionAttributes.consumable,
      points: true);

  static const stagePack = ProductId(
      android: 'so.a.iap.stage.1',
      ios: 'so.i.iap.stage.1',
      attr: TransactionAttributes.consumable,
      points: false);

  static const premiumWeeklyFreetrial = ProductId(
      android: 'm2.a.sub.premium',
      ios: 'm2.i.sub.premium.p1w',
      attr: TransactionAttributes.subscriptions,
      basePlan: 'weekly',
      offerId: 'freetrial',
      originId: premiumWeek);

  static const premiumWeeklyDiscount = ProductId(
      android: 'm2.a.sub.premium',
      ios: 'm2.i.sub.premium.p1w',
      attr: TransactionAttributes.subscriptions,
      basePlan: 'weekly',
      offerId: 'discount',
      originId: premiumWeek);

  static final premiumWeekOfferIds = <ProductId>{
    premiumWeeklyFreetrial,
    premiumWeeklyDiscount
  };

  static const premiumWeek = ProductId(
      android: 'm2.a.sub.premium',
      ios: 'm2.i.sub.premium.p1w',
      basePlan: 'weekly',
      attr: TransactionAttributes.subscriptions,
      points: false);

  static const premiumYearlyFreetrial = ProductId(
      android: 'm2.a.sub.premium',
      ios: 'm2.i.sub.premium.p1y',
      attr: TransactionAttributes.subscriptions,
      basePlan: 'yearly',
      offerId: 'freetrial',
      originId: premiumYear);

  static const premiumYearlyDiscount = ProductId(
      android: 'm2.a.sub.premium',
      ios: 'm2.i.sub.premium.p1y',
      attr: TransactionAttributes.subscriptions,
      basePlan: 'yearly',
      offerId: 'discount',
      originId: premiumYear);

  static final premiumYearOfferIds = <ProductId>{
    premiumYearlyFreetrial,
    premiumYearlyDiscount
  };

  static const premiumYear = ProductId(
      android: 'm2.a.sub.premium',
      ios: 'm2.i.sub.premium.p1y',
      basePlan: 'yearly',
      attr: TransactionAttributes.subscriptions,
      points: false);

  static final noAdsCapIds = <ProductId>{
    noAdsCoinBundle,
    noAds2,
    premiumWeek,
    premiumWeeklyFreetrial,
    premiumWeeklyDiscount,
    premiumYear,
    premiumYearlyFreetrial,
    premiumYearlyDiscount
  };

  static final premiumGroup = <ProductId>{
    premiumWeek,
    premiumWeeklyFreetrial,
    premiumWeeklyDiscount,
    premiumYear,
    premiumYearlyFreetrial,
    premiumYearlyDiscount
  };

  static final groupMap = <String, String>{
    premiumWeek.sku: 'premium',
    premiumWeeklyFreetrial.sku: 'premium',
    premiumWeeklyDiscount.sku: 'premium',
    premiumYear.sku: 'premium',
    premiumYearlyFreetrial.sku: 'premium',
    premiumYearlyDiscount.sku: 'premium'
  };

  static final oneOffChargeIapIds = <ProductId>{
    noAds,
    noAdsCoinBundle,
    noAds2,
    coin200,
    stagePack
  };

  static final subscriptionsIapIds = <ProductId>{
    premiumWeek,
    premiumWeeklyFreetrial,
    premiumWeeklyDiscount,
    premiumYear,
    premiumYearlyFreetrial,
    premiumYearlyDiscount
  };

  static final pointsIapIds = <ProductId>{coin200};

  static final rewardIds = <ProductId>{noAds};

  static final igcIds = <ProductId>{noAds};

  static const manifestBuilders = <ManifestBuilder>[
    buildNoAdsManifest,
    buildNoAdsCoinBundleManifest,
    buildThemeManifest,
    buildPropManifest,
    buildNoAds2Manifest,
    buildCoin200Manifest,
    buildStagePackManifest,
    buildPremiumWeekManifest,
    buildPremiumYearManifest
  ];

  static Future<Manifest?> buildNoAdsManifest(TransactionIntent intent) async {
    if (intent.productId != noAds) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    return Manifest('no_ads', extras: extras);
  }

  static bool isOwnNoAds(OrderEntity entity) {
    if (entity.state == TransactionState.success &&
        entity.category == 'no_ads') {
      return noAds.sku == entity.sku;
    }
    return false;
  }

  static Future<Manifest?> buildNoAdsCoinBundleManifest(
      TransactionIntent intent) async {
    if (intent.productId != noAdsCoinBundle) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    final details = <Details>[];
    details.add(Details.define(
        'igc', intent.sales ? max(500, (intent.rate * 500).toInt()) : 500,
        sku: 'igc'));
    details.add(Details.define(
        'cup', intent.sales ? max(1, (intent.rate * 1).toInt()) : 1,
        sku: 'cup'));
    details.add(Details.define(
        'frag', intent.sales ? max(20, (intent.rate * 20).toInt()) : 20,
        sku: 'frag'));
    return Manifest('no_ads', extras: extras, details: details);
  }

  static bool isOwnNoAdsCoinBundle(OrderEntity entity) {
    if (entity.state == TransactionState.success &&
        entity.category == 'no_ads_coin_bundle') {
      return noAdsCoinBundle.sku == entity.sku;
    }
    return false;
  }

  static ProductId theme(
    String themeId,
    TransactionMethod method,
  ) =>
      GuruApp.instance.defineProductId(
          'theme_${themeId}', TransactionAttributes.possessive, method);

  static Future<Manifest?> buildThemeManifest(TransactionIntent intent) async {
    final matches = themeRegExp.allMatches(intent.productId.sku);
    if (matches.isEmpty) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
      'theme_id': matches.first.group(1)!,
    };
    return Manifest('theme_${matches.first.group(1)!}', extras: extras);
  }

  static bool isOwnTheme(
    OrderEntity entity,
    String themeId,
  ) {
    if (entity.state == TransactionState.success &&
        entity.category == 'theme') {
      final match = themeRegExp.firstMatch(entity.sku);
      return match?.group(1) == themeId;
    }
    return false;
  }

  static ProductId prop(
    String propId,
    String pcId,
    TransactionMethod method,
  ) =>
      GuruApp.instance.defineProductId(
          'theme_${propId}_${pcId}', TransactionAttributes.possessive, method);

  static Future<Manifest?> buildPropManifest(TransactionIntent intent) async {
    final matches = propRegExp.allMatches(intent.productId.sku);
    if (matches.isEmpty) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    final details = <Details>[];
    details.add(Details.define(
        'prop', intent.sales ? max(1, (intent.rate * 1).toInt()) : 1,
        sku: '${matches.first.group(1)!}_${matches.first.group(2)!}')
      ..setString('theme_id', matches.first.group(1)!));
    details.add(Details.define(
        'pc', intent.sales ? max(1, (intent.rate * 1).toInt()) : 1,
        sku: 'pc')
      ..setString('theme_id', matches.first.group(2)!));
    return Manifest('prop', extras: extras, details: details);
  }

  static bool isOwnProp(
    OrderEntity entity,
    String propId,
    String pcId,
  ) {
    if (entity.state == TransactionState.success && entity.category == 'prop') {
      final match = propRegExp.firstMatch(entity.sku);
      return match?.group(1) == propId && match?.group(2) == pcId;
    }
    return false;
  }

  static Future<Manifest?> buildNoAds2Manifest(TransactionIntent intent) async {
    if (intent.productId != noAds2) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    final details = <Details>[];
    details.add(Details.define('no_ads', 1, sku: 'no_ads'));
    return Manifest('no_ads', extras: extras, details: details);
  }

  static bool isOwnNoAds2(OrderEntity entity) {
    if (entity.state == TransactionState.success &&
        entity.category == 'no_ads2') {
      return noAds2.sku == entity.sku;
    }
    return false;
  }

  static Future<Manifest?> buildCoin200Manifest(
      TransactionIntent intent) async {
    if (intent.productId != coin200) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    final details = <Details>[];
    details.add(Details.define(
        'coin', intent.sales ? max(200, (intent.rate * 200).toInt()) : 200,
        sku: 'coin'));
    return Manifest('coin', extras: extras, details: details);
  }

  static Future<Manifest?> buildStagePackManifest(
      TransactionIntent intent) async {
    if (intent.productId != stagePack) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    final details = <Details>[];
    details.add(Details.define(
        'stage', intent.sales ? max(1, (intent.rate * 1).toInt()) : 1,
        sku: 'stage')
      ..setInt('stage', 1));
    return Manifest('stage_1', extras: extras, details: details);
  }

  static Future<Manifest?> buildPremiumWeekManifest(
      TransactionIntent intent) async {
    if (!premiumWeekOfferIds.contains(intent.productId)) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    if (Platform.isAndroid && intent.productId.hasOffer) {
      extras[ExtraReservedField.basePlanId] = intent.productId.basePlan;
      extras[ExtraReservedField.offerId] = intent.productId.offerId;
    }
    final details = <Details>[];
    details.add(Details.define(
        'igc', intent.sales ? max(8000, (intent.rate * 8000).toInt()) : 8000,
        sku: 'igc'));
    return Manifest('sub', extras: extras, details: details);
  }

  static Future<Manifest?> buildPremiumYearManifest(
      TransactionIntent intent) async {
    if (!premiumYearOfferIds.contains(intent.productId)) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
    };
    if (Platform.isAndroid && intent.productId.hasOffer) {
      extras[ExtraReservedField.basePlanId] = intent.productId.basePlan;
      extras[ExtraReservedField.offerId] = intent.productId.offerId;
    }
    final details = <Details>[];
    details.add(Details.define(
        'igc', intent.sales ? max(16000, (intent.rate * 16000).toInt()) : 16000,
        sku: 'igc'));
    return Manifest('sub', extras: extras, details: details);
  }

  static Set<ProductId> get iapIds =>
      {...oneOffChargeIapIds, ...subscriptionsIapIds};
}

class _GuruTestABTestExperiments {
  static final test = ABTestExperiment(
      name: 'test',
      startTs: 1706457600000, // 2024-01-29 00:00:00.000
      endTs: 1706457600000, // 2024-01-29 00:00:00.000
      audience: ABTestAudience(filters: [
        VersionFilter.lessThan('2.3.0'),
        CountryFilter.excluded({'us', 'cn', 'en'}),
        PlatformFilter(
          androidCondition: AndroidCondition(
              opt: ConditionOpt.greaterThanOrEquals, sdkInt: 33),
          iosCondition:
              IosCondition(opt: ConditionOpt.greaterThanOrEquals, version: 14),
        ),
      ], variant: 2));

  static final test2 = ABTestExperiment(
      name: 'test2',
      startTs: 1706457600000, // 2024-01-29 00:00:00.000
      endTs: 1706457600000, // 2024-01-29 00:00:00.000
      audience: ABTestAudience(filters: [
        VersionFilter.lessThan('2.3.0'),
        CountryFilter.included({'cn'}),
        PlatformFilter(
          androidCondition:
              AndroidCondition(opt: ConditionOpt.lessThan, sdkInt: 24),
          iosCondition:
              IosCondition(opt: ConditionOpt.greaterThanOrEquals, version: 14),
        ),
        NewUserFilter(),
      ], variant: 5));

  static final experiments = <String, ABTestExperiment>{
    'test': test,
    'test2': test2,
  };
}

class _SpiderRemoteConfigConstants {
  static const iadsConfig = 'iads_config';

  static const radsConfig = 'rads_config';

  static const badsConfig = 'bads_config';

  static const Map<String, dynamic> _defaultConfigs = {
    iadsConfig:
        '{"free_s":600,"win_count":4,"scene":"game_start|new_block|p2g|p2h|reset_keep|reset_scs|ads_break|double|nap","sp_scene":"new_block:120;reset_scs:120","retry_min_s":10,"retry_max_s":600,"amazon_enable":false,"imp_gap_s":120}',
    radsConfig: '{"win_count":3}',
    badsConfig: '{"free_s":180,"win_count":1}',
  };

  static String getDefaultConfigString(String key) => _defaultConfigs[key];

  static String getKey(String key) => key;
}

class _SpiderAppSpec extends AppSpec {
  _SpiderAppSpec._();

  static final _instance = _SpiderAppSpec._();

  @override
  final appName = 'Spider';

  @override
  final appCategory = AppCategory.game;

  @override
  final flavor = 'Spider';

  @override
  final details = AppDetails(
    saasAppId: 'spider',
    authority: 'solitaire.fungame.studio',
    storagePrefix:
        'https://firebasestorage.googleapis.com/v0/b/solitaire-66fbf.appspot.com/o',
    defaultCdnPrefix: 'https://cdn1.solitaire.fungame.studio',
    androidGooglePlayUrl:
        'https://play.google.com/store/apps/details?id=solitaire.patience.card.games.klondike.free',
    policyUrl: 'https://solitaire.fungame.studio/policy.html',
    termsUrl: 'https://solitaire.fungame.studio/termsofservice.html',
    emailUrl: 'card@fungame.studio',
    packageName: 'guru.app.demo',
    bundleId: 'guru.app.demo',
    facebookAppId: '987654321',
  );

  @override
  final deployment = Deployment(
    propertyCacheSize: 512,
    enableDithering: false,
    disableRewardsAds: true,
  );

  @override
  final adsProfile = AdsProfile(
      bannerId:
          const AdUnitId(android: 'a1dc70299fd5d487', ios: '97da0e2028ba80b7'),
      interstitialId:
          const AdUnitId(android: '25b7c47878fcbf6a', ios: '4e7ba2c4921ecdfb'),
      rewardsId:
          const AdUnitId(android: '3cd13a4e5c388e7b', ios: '2a65c75c3ed690b2'),
      amazonAppId: const AdAppId(
          android: '22296b56-f6b3-4bee-9fd1-0cd6d5cc69bc',
          ios: '9fdfd4c0-3f34-4bd4-b9b4-1f649ff50a2a'),
      amazonBannerSlotId: const AdSlotId(
          android: '3c10ec33-a2bf-44be-ac9f-707853e63ff2',
          ios: '7cb36f8a-2953-4f02-a1cb-ec3dfdf33878'),
      amazonInterstitialSlotId: const AdSlotId(
          android: 'b7fac191-5986-4144-9fdb-691556b2e092',
          ios: '82d23cfa-2b5d-4501-bfc3-1cd2b688ed41'),
      pubmaticAppStoreUrl: Platform.isAndroid
          ? 'https://play.google.com/store/apps/details?id=solitaire.patience.card.games.klondike.free'
          : '');

  @override
  final productProfile = ProductProfile(
    oneOffChargeIapIds: _SpiderProducts.oneOffChargeIapIds,
    subscriptionsIapIds: _SpiderProducts.subscriptionsIapIds,
    pointsIapIds: _SpiderProducts.pointsIapIds,
    rewardIds: _SpiderProducts.rewardIds,
    igcIds: _SpiderProducts.igcIds,
    groupMap: _SpiderProducts.groupMap,
    manifestBuilders: _SpiderProducts.manifestBuilders,
    noAdsCapIds: _SpiderProducts.noAdsCapIds,
  );

  @override
  final adjustProfile = AdjustProfile(
      appToken: Platform.isAndroid ? 'fwbn7l32vpc0' : 'xxakw3rgxnnk',
      eventNameMapping: Platform.isAndroid
          ? <String, AdjustEventConverter>{
              "level_start": (_) => AdjustEvent("hq0xzz"),
              "in_app_purchase": (params) =>
                  AdjustProfile.createAdjustEvent("yzy3uh", params),
              "level_end": (_) => AdjustEvent("so63k4"),
              "tutorial_complete": (_) => AdjustEvent("95fu7q"),
            }
          : <String, AdjustEventConverter>{
              "level_start": (_) => AdjustEvent("b8khry"),
              "in_app_purchase": (params) =>
                  AdjustProfile.createAdjustEvent("z0gje7", params),
              "level_end": (_) => AdjustEvent("1p8z5t"),
              "tutorial_complete": (_) => AdjustEvent("1p8z5t"),
            });

  @override
  final defaultRemoteConfig = _SpiderRemoteConfigConstants._defaultConfigs;

  @override
  final localABTestExperiments = _SpiderABTestExperiments.experiments;

  @override
  String getRemoteConfigKey(String key) =>
      _SpiderRemoteConfigConstants.getKey(key);
}

class _SpiderProducts {
  static final themeRegExp = RegExp(r"^theme_(.*)$");

  static const noAds = ProductId(
      android: 'so.a.iap.noads.699',
      ios: 'so.i.iap.noads.699',
      attr: TransactionAttributes.possessive,
      points: false);

  static const coin200 = ProductId(
      android: 'so.a.iapc.coin.200',
      ios: 'so.i.iapc.coin.200',
      attr: TransactionAttributes.consumable,
      points: false);

  static final noAdsCapIds = <ProductId>{noAds};

  static final groupMap = <String, String>{};

  static final oneOffChargeIapIds = <ProductId>{};

  static final subscriptionsIapIds = <ProductId>{};

  static final pointsIapIds = <ProductId>{};

  static final rewardIds = <ProductId>{};

  static final igcIds = <ProductId>{};

  static const manifestBuilders = <ManifestBuilder>[buildThemeManifest];

  static ProductId theme(
    String themeId,
    TransactionMethod method,
  ) =>
      GuruApp.instance.defineProductId(
          'theme_${themeId}', TransactionAttributes.possessive, method);

  static Future<Manifest?> buildThemeManifest(TransactionIntent intent) async {
    final matches = themeRegExp.allMatches(intent.productId.sku);
    if (matches.isEmpty) {
      return null;
    }
    final extras = <String, dynamic>{
      ExtraReservedField.contentId: intent.productId.sku,
      ExtraReservedField.scene: intent.scene,
      ExtraReservedField.rate: intent.rate,
      ExtraReservedField.sales: intent.sales,
      'theme_id': matches.first.group(1)!,
    };
    final details = <Details>[];
    details.add(Details.define(
        'theme', intent.sales ? max(1, (intent.rate * 1).toInt()) : 1,
        sku: 'theme'));
    return Manifest('${matches.first.group(1)!}',
        extras: extras, details: details);
  }

  static bool isOwnTheme(
    OrderEntity entity,
    String themeId,
  ) {
    if (entity.state == TransactionState.success &&
        entity.category == 'theme') {
      final match = themeRegExp.firstMatch(entity.sku);
      return match?.group(1) == themeId;
    }
    return false;
  }

  static Set<ProductId> get iapIds =>
      {...oneOffChargeIapIds, ...subscriptionsIapIds};
}

class _SpiderABTestExperiments {
  static final experiments = <String, ABTestExperiment>{};
}

class RemoteConfigConstants {
  static const iadsConfig = 'iads_config';

  static const radsConfig = 'rads_config';

  static const badsConfig = 'bads_config';

  static const analyticsConfig = 'analytics_config';
}

class ABTestExperimentConstants {
  static Map<String, ABTestExperiment> get experiments {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _GuruTestABTestExperiments.experiments;
    }
    if (GuruApp.instance.flavor == 'Spider') {
      return _SpiderABTestExperiments.experiments;
    }
    return {};
  }
}

class ProductIds {
  static ProductId get noAds {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.noAds;
    }
    if (GuruApp.instance.flavor == 'Spider') {
      return _SpiderProducts.noAds;
    }
    return ProductId.invalid;
  }

  static ProductId get noAdsCoinBundle {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.noAdsCoinBundle;
    }
    return ProductId.invalid;
  }

  static ProductId get noAds2 {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.noAds2;
    }
    return ProductId.invalid;
  }

  static ProductId get coin200 {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.coin200;
    }
    if (GuruApp.instance.flavor == 'Spider') {
      return _SpiderProducts.coin200;
    }
    return ProductId.invalid;
  }

  static ProductId get stagePack {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.stagePack;
    }
    return ProductId.invalid;
  }

  static ProductId get premiumWeeklyFreetrial {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.premiumWeeklyFreetrial;
    }
    return ProductId.invalid;
  }

  static ProductId get premiumWeeklyDiscount {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.premiumWeeklyDiscount;
    }
    return ProductId.invalid;
  }

  static ProductId get premiumWeek {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.premiumWeek;
    }
    return ProductId.invalid;
  }

  static ProductId get premiumYearlyFreetrial {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.premiumYearlyFreetrial;
    }
    return ProductId.invalid;
  }

  static ProductId get premiumYearlyDiscount {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.premiumYearlyDiscount;
    }
    return ProductId.invalid;
  }

  static ProductId get premiumYear {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.premiumYear;
    }
    return ProductId.invalid;
  }

  static ProductId theme(
    String themeId,
    TransactionMethod method,
  ) {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.theme(themeId, method);
    }
    if (GuruApp.instance.flavor == 'Spider') {
      return _SpiderProducts.theme(themeId, method);
    }
    return ProductId.invalid;
  }

  static ProductId prop(
    String propId,
    String pcId,
    TransactionMethod method,
  ) {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.prop(propId, pcId, method);
    }
    return ProductId.invalid;
  }

  static Set<ProductId> get noAdsCapIds {
    if (GuruApp.instance.flavor == 'guru_test') {
      return _Guru_testProducts.noAdsCapIds;
    }
    if (GuruApp.instance.flavor == 'Spider') {
      return _SpiderProducts.noAdsCapIds;
    }
    return {};
  }

  static Set<ProductId> get iapIds => GuruApp.instance.productProfile.iapIds;

  static Set<ProductId> get oneOffChargeIapIds =>
      GuruApp.instance.productProfile.oneOffChargeIapIds;

  static Set<ProductId> get subscriptionsIapIds =>
      GuruApp.instance.productProfile.subscriptionsIapIds;

  static Set<ProductId> get pointsIapIds =>
      GuruApp.instance.productProfile.pointsIapIds;

  static Set<ProductId> get rewardIds =>
      GuruApp.instance.productProfile.rewardIds;
}

class ProductCategory {
  static const noAds = 'no_ads';

  static const prop = 'prop';

  static const coin = 'coin';

  static const stage1 = 'stage_1';

  static const sub = 'sub';

  static theme(String themeId) {
    "theme_${themeId}";
  }
}

class _GuruSpecFactory {
  static AppSpec create(String flavor) {
    if (flavor == 'guru_test') {
      return _Guru_testAppSpec._instance;
    }
    if (flavor == 'Spider') {
      return _SpiderAppSpec._instance;
    }
    throw NotImplementationAppSpecCreatorException();
  }
}

class Flavors {
  static const guruTest = 'guru_test';

  static const spider = 'Spider';
}
