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

    /**
     * Terms of Service Information.
     * @param title The title of Terms and use.
     * @param subTitle The sub title of terms of use.
     * @param url Url of terms of use.
     * @param isRequired Is it a condition that must be agreed.
     * @since 2.0.0
     */
    public class TermsOfServiceData
    {
        /**
         * The title of Terms and use.
         * @since 2.0.0
         */
        public string Title { get; }

        /**
         * Url of terms of use.
         * @since 2.0.0
         */
        public string URL { get; }

        /**
         * Is it a condition that must be agreed.
         * @since 2.0.0
         */
        public bool IsRequired { get; }
        internal string Identifier { get; }
        /**
         * Service id of terms of use.
         * @since 2.0.0
         */
        public string ServiceId { get; }
        /**
         * Type of terms of use.
         * @since 2.0.0
         */
        public string Type { get; }

        internal int Sequence { get; }

        /**
        * text.
        * @since 2.4.0
        */
        public string Text { get; }

        /**
         * Consent.
         * @since 2.0.0
         */
        public bool IsAgreed { get; set; }

        public TermsOfServiceData(string title, string url, bool isRequired, string identifier, string serviceId, string type, int sequence, string text, bool isAgreed)
        {
            Title = title;
            URL = url;
            IsRequired = isRequired;
            Identifier = identifier;
            ServiceId = serviceId;
            Type = type;
            Sequence = sequence;
            Text = text;
            IsAgreed = isAgreed;
        }

        /**
         * Dictionary deserialization.
         * @since 2.0.0
         */
        public TermsOfServiceData(Dictionary<string, object> dictionary)
        {
            Title = dictionary["title"] as string;
            URL = dictionary["url"] as string;
            IsAgreed = Convert.ToBoolean(dictionary["isRequired"]);
            Identifier = dictionary["identifier"] as string;
            ServiceId = dictionary["serviceId"] as string;
            Type = dictionary["type"] as string;
            Sequence = Convert.ToInt32(dictionary["sequence"]);
            Text = dictionary["text"] as string;
            IsAgreed = Convert.ToBoolean(dictionary["isAgreed"]);
        }

        /**
         * Dictionary serialization.
         * @since 2.0.0
         */
        public Dictionary<string, object> ToDictionary()
        {
            Dictionary<string, object> dictionary = new Dictionary<string, object>();
            dictionary.Add("title", Title);
            dictionary.Add("url", URL);
            dictionary.Add("isRequired", IsRequired);
            dictionary.Add("identifier", Identifier);
            dictionary.Add("serviceId", ServiceId);
            dictionary.Add("type", Type);
            dictionary.Add("sequence", Sequence);
            dictionary.Add("text", Text);
            dictionary.Add("isAgreed", IsAgreed);
            return dictionary;
        }

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

            return Json.Serialize(dictionary);
        }

        public override string ToString()
        {
            return "TermsOfServiceData(Title='" + Title
            + "', Url='" + URL
            + "', IsRequired=" + IsRequired
            + ", Identifier='" + Identifier
            + "', ServiceId='" + ServiceId
            + "', Type='" + Type
            + "', Sequence=" + Sequence
            + ", Text='" + Text
            + "', IsAgreed=" + IsAgreed + ")";
        }
    }
}
