﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;
using SimpleJSON;

public class QueryParamsHandler : MonoBehaviour {

    [DllImport("__Internal")]
    private static extern string CheckIfCreatorCorps();

    [DllImport("__Internal")]
    private static extern string GetMoodleDetails();

    [DllImport("__Internal")]
    private static extern string CheckToUnlockClassroomItems();

    public static bool IsCreatorCorps()
    {
        string isCreatorCorps = CheckIfCreatorCorps();

        return isCreatorCorps == "true" ? true : false;
    }

    public static JSONNode GetMoodleData()
    {
        var dataString = GetMoodleDetails();
        var data = JSON.Parse(dataString);

        return data;
    }

    public static bool UnlockClassroomItems() {
        string unlockClassroomItems = CheckToUnlockClassroomItems();
        Debug.Log("UnlockClassroomItems: " + unlockClassroomItems);

        return unlockClassroomItems == "true" ? true : false;
    }
}
