import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:get/get.dart';
import 'package:guru_widgets/appbar/guru_app_bar.dart';
import 'package:guru_widgets/pages/settings/guru_settings_page.dart';
import 'package:guru_app/financial/igc/igc_manager.dart';
import 'package:guru_app/financial/iap/iap_manager.dart';
import 'package:guru_app/controller/assets_aware.dart';
import 'package:guru_utils/controller/lifecycle_controller.dart';
import 'package:guru_app/financial/product/product_model.dart';
import 'package:guru_app/ads/ads_manager.dart';

import 'assets_dubug_controller.dart';

// guru_app finacial/product/model
class ProductIds {
  late ProductId noAds;
}

class AssetsDebugPage extends GetWidget<AssetsDebugController> {
  final LeadingType leadingType;
  final ProductIds? productIds;

  AssetsDebugPage(
      {Key? key,
      this.leadingType = LeadingType.close,
      this.productIds})
      : super(key: key) {
    Get.create<AssetsDebugController>(() => GetIt.instance<AssetsDebugController>());
  }

  @override
  Widget build(BuildContext context) {
    return GuruSettingsPage(
      items: [
        GroupSetting(
          title: "Games",
          items: [
            EntranceSetting(title: "MAX Mediation Debugger", onTap: () async {
              
            }), 
            EntranceSetting(title: "Clear All Gems", onTap: () {
              controller.clearGems();
            })
          ]
        ),
        GroupSetting(
          title: "IAP",
          items: [
            EntranceSetting(title: "Test Buy No Ads", onTap: () async {
              if (productIds != null) {
                final products = await IapManager.instance
                .buildProducts({productIds!.noAds.createIntent(scene: "debug")});
                final product = products.getProduct(productIds!.noAds);
                if (product != null) {
                  controller.requestProduct(product);
                }
              }
              
            }), 
            EntranceSetting(title: "Test Subscription Premium Month", onTap: () async {
              
            }),
            EntranceSetting(title: "Beginner Pack State", onTap: () async {
              
            }),
            EntranceSetting(title: "Restore IAP", onTap: () async {
              controller.restorePurchases();
            }),
            EntranceSetting(title: "Clear IAP Asset", onTap: () async {
              controller.clearIapAssets();
              AdsManager.instance.noBannerAndInterstitialAdsSubject.add(false);
            }),
          ]
        ),
        GroupSetting(
          title: "SPECIAL OFFER",
          items: [
            EntranceSetting(title: "Refresh Special Offer", onTap: () async {
              
            }), 
            EntranceSetting(title: "Modify Special Offer SKU", onTap: () async {
              
            }),
            EntranceSetting(title: "Modify Special Off End Date Time", onTap: () async {
              
            }),
            EntranceSetting(title: "Refresh Special Offer Id", onTap: () async {
              controller.restorePurchases();
            }),
            EntranceSetting(title: "Refresh Special Offer Latest Shown Id", onTap: () async {

            }),
            EntranceSetting(title: "Modify Special Offer New Date", onTap: () async {
              
            }),
            EntranceSetting(title: "Modify Special Offer Status", onTap: () async {
              
            }),
            EntranceSetting(title: "Clear All Special Offer", onTap: () async {
              
            }),
          ]
        ),
        GroupSetting(
          title: "DAILY QUEST",
          items: [
            EntranceSetting(title: "Force Enable Daily Quest", onTap: () async {
              
            }),
            EntranceSetting(title: "Quick Complete!!", onTap: () async {
              
            }),
            EntranceSetting(title: "Reset Mystery Jackpot", onTap: () async {
              
            }),
            EntranceSetting(title: "Clear Daily Quest items", onTap: () async {
              
            }),
            EntranceSetting(title: "Reset All Daily Quest Data", onTap: () async {
              
            }),
          ]
        ),
        GroupSetting(
          title: "REWARDS",
          items: [
            EntranceSetting(title: "Clear Daily Rewards", onTap: () async {
              
            }),
            EntranceSetting(title: "Reset Today Claimed Status", onTap: () async {
              
            }),
            EntranceSetting(title: "Increase Daily Rewards Cumulative Days", onTap: () async {
              
            }),
            EntranceSetting(title: "Decrease Daily Rewards Cumulative Days", onTap: () async {
              
            })
          ]
        ),
        GroupSetting(
          title: "PROPS",
          items: [
            EntranceSetting(title: "Claim a Hammer Props of AdsReward", onTap: () async {
              
            }),
            EntranceSetting(title: "Claim a Swap Props of AdsReward", onTap: () async {
              
            }),
            EntranceSetting(title: "Claim a Undo Props of AdsReward", onTap: () async {
              
            })
          ]
        ),
        GroupSetting(
          title: "MISC",
          items: [
            EntranceSetting(title: "Clear Redeenmed Promo Code", onTap: () async {
              
            })
          ]
        ),
      ]
    );
  }
 
}