using Xamarin.Forms;

namespace Pixiview.UI.Theme
{
    public abstract class ThemeBase : ResourceDictionary
    {
        public const string FontIconUser = nameof(FontIconUser);
        public const string FontIconSparkles = nameof(FontIconSparkles);
        public const string FontIconOrder = nameof(FontIconOrder);
        public const string FontIconRefresh = nameof(FontIconRefresh);
        public const string FontIconLove = nameof(FontIconLove);
        public const string FontIconNotLove = nameof(FontIconNotLove);
        public const string FontIconCircleLove = nameof(FontIconCircleLove);
        public const string FontIconOption = nameof(FontIconOption);
        public const string FontIconFavorite = nameof(FontIconFavorite);
        public const string FontIconShare = nameof(FontIconShare);
        public const string FontIconMore = nameof(FontIconMore);
        public const string FontIconCaretCircleLeft = nameof(FontIconCaretCircleLeft);
        public const string FontIconCaretCircleRight = nameof(FontIconCaretCircleRight);
        public const string FontIconCalendarDay = nameof(FontIconCalendarDay);
        public const string FontIconCloudDownload = nameof(FontIconCloudDownload);
        public const string IconCircleCheck = nameof(IconCircleCheck);
        public const string IconCaretDown = nameof(IconCaretDown);
        public const string IconClose = nameof(IconClose);

        public const string StatusBarStyle = nameof(StatusBarStyle);
        public const string WindowColor = nameof(WindowColor);
        public const string TintColor = nameof(TintColor);
        public const string TextColor = nameof(TextColor);
        public const string SubTextColor = nameof(SubTextColor);
        public const string CardBackgroundColor = nameof(CardBackgroundColor);
        public const string MaskColor = nameof(MaskColor);
        public const string NavColor = nameof(NavColor);
        public const string NavSelectedColor = nameof(NavSelectedColor);
        public const string OptionBackColor = nameof(OptionBackColor);
        public const string OptionTintColor = nameof(OptionTintColor);

        public const string IconLightFontFamily = nameof(IconLightFontFamily);
        public const string IconRegularFontFamily = nameof(IconRegularFontFamily);
        public const string IconSolidFontFamily = nameof(IconSolidFontFamily);
        //public const string Horizon10 = nameof(Horizon10);
        public const string ScreenBottomPadding = nameof(ScreenBottomPadding);

        protected void InitResources()
        {
            //Add(Horizon10, StyleDefinition.Horizon10);
            Add(ScreenBottomPadding, StyleDefinition.ScreenBottomPadding);

            Add(IconLightFontFamily, StyleDefinition.IconLightFontFamily);
            Add(IconRegularFontFamily, StyleDefinition.IconRegularFontFamily);
            Add(IconSolidFontFamily, StyleDefinition.IconSolidFontFamily);

            var regularFontFamily = StyleDefinition.IconRegularFontFamily;
            var solidFontFamily = StyleDefinition.IconSolidFontFamily;

            Add(FontIconLove, GetSolidIcon(StyleDefinition.IconLove, solidFontFamily, StyleDefinition.ColorRedBackground));
            Add(FontIconCircleLove, GetSolidIcon(StyleDefinition.IconCircleLove, solidFontFamily, StyleDefinition.ColorRedBackground));
            Add(FontIconUser, GetSolidIcon(StyleDefinition.IconUser, solidFontFamily));
            Add(FontIconSparkles, GetSolidIcon(StyleDefinition.IconSparkles, solidFontFamily));
            Add(FontIconOrder, GetSolidIcon(StyleDefinition.IconOrder, solidFontFamily));
            Add(FontIconRefresh, GetSolidIcon(StyleDefinition.IconRefresh, solidFontFamily));
            Add(FontIconNotLove, GetSolidIcon(StyleDefinition.IconLove, regularFontFamily));
            Add(FontIconOption, GetSolidIcon(StyleDefinition.IconOption, solidFontFamily));
            Add(FontIconFavorite, GetSolidIcon(StyleDefinition.IconFavorite, solidFontFamily));
            Add(FontIconShare, GetSolidIcon(StyleDefinition.IconShare, solidFontFamily));
            Add(FontIconMore, GetSolidIcon(StyleDefinition.IconMore, regularFontFamily));
            Add(FontIconCaretCircleLeft, GetSolidIcon(StyleDefinition.IconCaretCircleLeft, solidFontFamily));
            Add(FontIconCaretCircleRight, GetSolidIcon(StyleDefinition.IconCaretCircleRight, solidFontFamily));
            Add(FontIconCalendarDay, GetSolidIcon(StyleDefinition.IconCalendarDay, regularFontFamily));
            Add(FontIconCloudDownload, GetSolidIcon(StyleDefinition.IconCloudDownload, solidFontFamily));

            Add(IconCircleCheck, StyleDefinition.IconCircleCheck);
            Add(IconCaretDown, StyleDefinition.IconCaretDown);
            Add(IconClose, StyleDefinition.IconClose);
        }

        private FontImageSource GetSolidIcon(string icon, string family, Color color = default)
        {
            return new FontImageSource
            {
                FontFamily = family,
                Glyph = icon,
                Size = StyleDefinition.FontSizeTitle,
                Color = color
            };
        }
    }
}
