﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Yodo1.FanCraft
{
    public class InterstitialNotificationTheme
    {
        private Color defaultColor = new Color(0, 0, 0, 0);

        public Color OverlayColor { get; set; }

        // For background color of the popup in text, image, poll_image, poll notifications.
        public Color PopupBackgroundColor { get; set; }

        // For title size in all notifications except Image.
        public int TitleFontSize { get; set; }

        // If set, this will override Text Color for titles in all notifications.
        public Color TitleColor { get; set; }

        // For Text Poll description, Image Poll description, and Poll option text size.
        public int DescriptionFontSize { get; set; }

        // For CTA button background color.
        public Color CtaBackgroundColor { get; set; }

        // For CTA button font size.
        public int CtaFontSize { get; set; }

        // Color for CTA button text.
        public Color CtaTextColor { get; set; }

        // For the background color of the poll option.
        public Color PollOptionBackgroundColor { get; set; }

        // For Poll Option text color.
        public Color PollOptionTextColor { get; set; }

        //For all text unless specifically overridden?
        public Color TextColor { get; set; }

        public Dictionary<string, object> ToDictionary()
        {
            Dictionary<string, object> dict = new Dictionary<string, object>();
            dict.Add("titleFontSize", TitleFontSize);
            dict.Add("descriptionFontSize", DescriptionFontSize);
            dict.Add("ctaFontSize", CtaFontSize);
            if (OverlayColor.Equals(defaultColor))
            {
                dict.Add("overlayColor", string.Empty);
            }
            else
            {
                dict.Add("overlayColor", "#" + ColorUtility.ToHtmlStringRGBA(OverlayColor));
            }

            if (PopupBackgroundColor.Equals(defaultColor))
            {
                dict.Add("popupBackgroundColor", string.Empty);
            }
            else
            {
                dict.Add("popupBackgroundColor", "#" + ColorUtility.ToHtmlStringRGBA(PopupBackgroundColor));
            }

            if (CtaBackgroundColor.Equals(defaultColor))
            {
                dict.Add("ctaBackgroundColor", string.Empty);
            }
            else
            {
                dict.Add("ctaBackgroundColor", "#" + ColorUtility.ToHtmlStringRGBA(CtaBackgroundColor));
            }

            if (TitleColor.Equals(defaultColor))
            {
                dict.Add("titleColor", string.Empty);
            }
            else
            {
                dict.Add("titleColor", "#" + ColorUtility.ToHtmlStringRGBA(TitleColor));
            }

            if (CtaTextColor.Equals(defaultColor))
            {
                dict.Add("ctaTextColor", string.Empty);
            }
            else
            {
                dict.Add("ctaTextColor", "#" + ColorUtility.ToHtmlStringRGBA(CtaTextColor));
            }

            if (PollOptionBackgroundColor.Equals(defaultColor))
            {
                dict.Add("pollOptionBackgroundColor", string.Empty);
            }
            else
            {
                dict.Add("pollOptionBackgroundColor", "#" + ColorUtility.ToHtmlStringRGBA(PollOptionBackgroundColor));
            }

            if (PollOptionTextColor.Equals(defaultColor))
            {
                dict.Add("pollOptionTextColor", string.Empty);
            }
            else
            {
                dict.Add("pollOptionTextColor", "#" + ColorUtility.ToHtmlStringRGBA(PollOptionTextColor));
            }

            if (TextColor.Equals(defaultColor))
            {
                dict.Add("textColor", string.Empty);
            }
            else
            {
                dict.Add("textColor", "#" + ColorUtility.ToHtmlStringRGBA(TextColor));
            }

            return dict;
        }
    }
}