﻿namespace Stove.StoveSDK
{
    using System;
    using System.Collections.Generic;
    using MiniJSON;

    public class ViewNavigation
    {
        bool EnableBackButton { get; set; }
        bool EnableForwardButton { get; set; }
        bool EnableRefreshButton { get; set; }
        bool EnableHomeButton { get; set; }

        public ViewNavigation(bool enableBackButton, bool enableForwardButton, bool enableRefreshButton, bool enableHomeButton)
        {
            EnableBackButton = enableBackButton;
            EnableForwardButton = enableForwardButton;
            EnableRefreshButton = enableRefreshButton;
            EnableHomeButton = enableHomeButton;
        }

        public ViewNavigation()
        {

        }

        /**
         * Dictionary deserialization.
         * @since 2.0.0
         */
        public ViewNavigation(Dictionary<string, object> dictionary)
        {
            EnableBackButton = Convert.ToBoolean(dictionary["enableBackButton"]);
            EnableForwardButton = Convert.ToBoolean(dictionary["enableForwardButton"]);
            EnableRefreshButton = Convert.ToBoolean(dictionary["enableRefreshButton"]);
            EnableHomeButton = Convert.ToBoolean(dictionary["enableHomeButton"]);
        }

        /**
         * Dictionary serialization.
         * @since 2.0.0
         */
        public Dictionary<string, object> ToDictionary()
        {
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            dictionary.Add("enableBackButton", EnableBackButton);
            dictionary.Add("enableForwardButton", EnableForwardButton);
            dictionary.Add("enableRefreshButton", EnableRefreshButton);
            dictionary.Add("enableHomeButton", EnableHomeButton);

            return dictionary;
        }

        /**
         * JSON serialization.
         * @since 2.0.0
         */
        public string ToJSONString()
        {
            Dictionary<string, object> dictionary = ToDictionary();

            return Json.Serialize(dictionary);
        }
    }
}