﻿#if UNITY_IPHONE || UNITY_IOS
namespace Yodo1.FanCraft
{
    using System.Collections.Generic;
    using System.Runtime.InteropServices;

    public class FanCraftSDK_iOS : FanCraftSDKImpi
    {
        [DllImport("__Internal")]
        private static extern void UnityFanCraft_Init(string appKey, string gameUserSettingsJsonString, string privacySettingsJsonString, string pushNotificationSettingsJsonString, string configurationJsonString, string gameObjectName, string callbackName);

        [DllImport("__Internal")]
        private static extern void UnityFanCraft_UpdateGameUser(string gameUserJsonString, string gameObjectName, string callbackName);

        [DllImport("__Internal")]
        private static extern void UnityFanCraft_SetTags(string tagsJsonString, string gameObjectName, string callbackName);

        [DllImport("__Internal")]
        private static extern void UnityFanCraft_ShowInterstitialNotification(string gameObjectName, string callbackName);

        [DllImport("__Internal")]
        private static extern void UnityFanCraft_ShowInterstitialNotificationByLocation(string locationId, string gameObjectName, string callbackName);

        [DllImport("__Internal")]
        private static extern void UnityFanCraft_RegisterForRemoteNotifications(string gameObjectName, string callbackName);


        public override void Init(string appKey, string gameUserSettingsJsonString, string privacySettingsJsonString, string pushNotificationSettingsJsonString, string configurationJsonString, string gameObjectName, string callbackName)
        {
            UnityFanCraft_Init(appKey, gameUserSettingsJsonString, privacySettingsJsonString, pushNotificationSettingsJsonString, configurationJsonString, gameObjectName, callbackName);
        }

        public override void UpdateGameUser(string gameUserJsonString, string gameObjectName, string callbackName)
        {
            UnityFanCraft_UpdateGameUser(gameUserJsonString, gameObjectName, callbackName);
        }

        public override void SetTags(List<string> tags, string gameObjectName, string callbackName)
        {
            string tagsJsonString = JsonUtility.Serialize(tags);
            UnityFanCraft_SetTags(tagsJsonString, gameObjectName, callbackName);
        }

        public override void ShowInterstitialNotification(string gameObjectName, string callbackName)
        {
            UnityFanCraft_ShowInterstitialNotification(gameObjectName, callbackName);
        }

        public override void ShowInterstitialNotificationByLocation(string locationId, string gameObjectName, string callbackName)
        {
            UnityFanCraft_ShowInterstitialNotificationByLocation(locationId, gameObjectName, callbackName);
        }

        public override void RegisterForRemoteNotifications(string gameObjectName, string callbackName)
        {
            UnityFanCraft_RegisterForRemoteNotifications(gameObjectName, callbackName);
        }

    }

}
#endif