using System;

namespace DlserveSDK
{
    public class DlserveNotificationEvent
    {
        public string Type { get; private set; }
        public string Title { get; private set; }
        public string Body { get; private set; }
        public string ClickUrl { get; private set; }

        internal static DlserveNotificationEvent FromJson(string json)
        {
            var wrapper = UnityEngine.JsonUtility.FromJson<JsonWrapper>(json);
            return new DlserveNotificationEvent
            {
                Type = wrapper.type ?? "",
                Title = wrapper.title ?? "",
                Body = wrapper.body ?? "",
                ClickUrl = wrapper.clickUrl ?? "",
            };
        }

        [Serializable]
        private class JsonWrapper
        {
            public string type;
            public string title;
            public string body;
            public string clickUrl;
        }
    }
}
