using System;
using UnityEngine;

namespace EngineSdkConverter.Unity.SDK
{
    /// <summary>
    /// 防沉迷信息变更通知回调
    /// </summary>
    #if UNITY_ANDROID
    public class CertificationInfoChangedCallbackType : AndroidJavaProxy
    {
        public CertificationInfoChangedCallbackType() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.SurveyInterface$SurveyInfoChanged") { }
        public Action<string> callback;

        public void onSuccess(string data)
        {
            NativeCallBack.Enqueue(() =>
            {
                callback?.Invoke(data);
            });
        }
    }
    #endif

    /// <summary>
    /// 防沉迷信息设置通知回调
    /// </summary>
    #if UNITY_ANDROID
    public class CertificationSetCallbackType : AndroidJavaProxy
    {
        public CertificationSetCallbackType() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.SurveyInterface$Result") { }
        public Action<string> callback;

        public void onSuccess(string data)
        {
            NativeCallBack.Enqueue(() =>
            {
                callback?.Invoke(data);
            });
        }

        public void onFail(string data)
        {
            NativeCallBack.Enqueue(() =>
            {
                callback?.Invoke(data);
            });
        }
    }
    #endif

    /// <summary>
    /// 重新防沉迷信息设置通知回调
    /// </summary>
    #if UNITY_ANDROID
    public class ReCertificationSetCallbackType : AndroidJavaProxy
    {
        public ReCertificationSetCallbackType() : base("com.tuyoo.sdk.sdk_inter_layer.interfaces.SurveyInterface$Result") { }
        public Action<string> callback;

        public void onSuccess(string data)
        {
            NativeCallBack.Enqueue(() =>
            {
                callback?.Invoke(data);
            });
        }

        public void onFail(string data)
        {
            NativeCallBack.Enqueue(() =>
            {
                callback?.Invoke(data);
            });
        }
    }
    #endif

    /// <summary>
    /// 防沉迷信息参数
    /// </summary>
    public class CertificationEventBuilder
    {
        public class CertificationEvent
        {
            public string citizenId;
            public string citizenName;
            public string oldId;
            public string oldName;
        }

        private CertificationEvent _event;

        public CertificationEventBuilder()
        {
            _event = new CertificationEvent();
        }

        public CertificationEventBuilder SetCitizenId(string id)
        {
            _event.citizenId = id;
            return this;
        }

        public CertificationEventBuilder SetCitizenName(string name)
        {
            _event.citizenName = name;
            return this;
        }

        public CertificationEventBuilder SetOldId(string id)
        {
            _event.oldId = id;
            return this;
        }

        public CertificationEventBuilder SetOldName(string name)
        {
            _event.oldName = name;
            return this;
        }

        public CertificationEvent Build()
        {
            return _event;
        }
    }

}