using Foundation;
using UIKit;
//using PokktExtension;
using PokktExtension.iOS;
using System;
//using System.CodeDom.Compiler;
using PokktExtension.Enums;
using System.Collections.Generic;

namespace SampleApp.iOS
{
	partial class DemoSelector : UIViewController
	{
		//private PokktConfig pokktConfig;

		public DemoSelector (string nibName, NSBundle bundle) : base (nibName, bundle)
		{
		}

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			//DisableButton ();

			//Setting extension and adding event
			PokktExtension.PokktAds.SetNativeExtentions(new IosExtension());
			PokktExtension.PokktAds.SetThirdPartyUserId("123456");
			PokktExtension.PokktAds.Debugging.ShouldDebug(true);
            PokktExtension.PokktAds.GetPokktSDKVersion();
            PokktExtension.PokktAds.SetPokktConfig("a2717a45b835b5e9f50284a38d62a74e", "iJ02lJss0M");// video demo

            Dictionary<string, string> extraParam = new Dictionary<string, string>();
			extraParam.Add("Key 1", "value 1");
			extraParam.Add("Key 2", "value 2");
			extraParam.Add("Key 3", "value 3");
			extraParam.Add("Key 4", "value 4");
			PokktExtension.PokktAds.SetCallbackExtraParams(extraParam);

			PokktExtension.PokktAds.Banner.BannerLoadedEvent += BannerLoaded;
			PokktExtension.PokktAds.Banner.BannerLoadFailedEvent += BannerLoadFailed;

			// to close keyboard agter changes in screen name
			txtFldScreen.ShouldReturn = (textField) =>
			{
				textField.ResignFirstResponder();
				return true;
			};

		}

		public override void DidReceiveMemoryWarning ()
		{
			base.DidReceiveMemoryWarning();
			// Dispose of any resources that can be recreated.
		}

		partial void DemoScreen1Btn_TouchUpInside (UIButton sender)
		{
            VideoAdScreen videoAdScreen = new VideoAdScreen(txtFldScreen.Text);
            this.NavigationController.PushViewController(videoAdScreen, true);
		}

		partial void DemoScreen2Btn_TouchUpInside (UIButton sender)
		{
			InterstitialScreenVC interstitialScreen = new InterstitialScreenVC(txtFldScreen.Text);
			this.NavigationController.PushViewController(interstitialScreen, true);
		}

		partial void TestBannerBtn_TouchUpInside(UIButton sender)
		{
			PokktExtension.PokktAds.Banner.LoadBanner(txtFldScreen.Text, (int)BannerPosition.TopCenter);
		}


		partial void ExportLogBtn_TouchUpInside (UIButton sender)
		{
		//	PokktManager.ExportLog();
		}

		private void ShowDemoScreen(string adType)
		{ 
            VideoAdScreen videoAdScreen = new VideoAdScreen (txtFldScreen.Text);
            this.NavigationController.PushViewController(videoAdScreen, true);
		}

		void BannerLoaded (string screenName)
		{
			Console.WriteLine("BannerLoaded called:" + screenName);
		}

		void BannerLoadFailed(string screenName, string message)
		{
			Console.WriteLine("BannerLoadFailed called");

		}

	}
}
