using UnityEngine;
using FRVR;
using TMPro;
public class ExampleScene : MonoBehaviour
{
    public TMP_InputField localInput;
    public TMP_InputField cloudInput;
    // Start is called once before the first execution of Update after the MonoBehaviour is created
    void Start()
    {
        FRVRSDK.Init(() =>
        {
            Debug.Log("FRVRSDK initialized");

            FRVRSDK.Analytics.LogLevelStart("Level 1 start");
        });
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void showInterstitial()
    {
        FRVRSDK.Ad.ShowInterstitialAd(() =>
        {
            Debug.Log("Interstitial ad started");
        }, (error) =>
        {
            Debug.Log("Interstitial ad error: " + error);
        }, () =>
        {
            Debug.Log("Interstitial ad finished");
        });
    }

    public void showReward()
    {
        FRVRSDK.Ad.ShowRewardAd(() =>
        {
            Debug.Log("Reward ad started");
        }, (error) =>
        {
            Debug.Log("Reward ad error: " + error);
        }, () =>
        {
            Debug.Log("Reward ad finished");
        });
    }

    public void localSave()
    {
        FRVRSDK.Data.SetItem("localKey", localInput.text, (result) => {
            Debug.Log($"Local item set: {result}");
        });
    }

    public void localLoad()
    {
        FRVRSDK.Data.GetItem("localKey", (value) => {
            localInput.text = (string)value;
            Debug.Log($"Local item retrieved: {value}");
        });
    }
}
