using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;

namespace Sonex.Client.Controls
{
    public sealed partial class PropertyBox : ContentControl
    {
        private static readonly Style DefaultControlStyle = LoadDefaultStyle();

        public PropertyBox()
        {
            Style = DefaultControlStyle;
        }

        private static Style LoadDefaultStyle()
        {
            var dictionary = new ResourceDictionary
            {
                Source = new Uri("ms-appx:///Controls/PropertyBox.xaml")
            };

            return (Style)dictionary["PropertyBoxStyle"];
        }


        public string Title
        {
            get => (string)GetValue(TitleProperty);
            set => SetValue(TitleProperty, value);
        }

        public static readonly DependencyProperty TitleProperty =
            DependencyProperty.Register(
                nameof(Title),
                typeof(string),
                typeof(PropertyBox),
                new PropertyMetadata(string.Empty));



        public string Description
        {
            get => (string)GetValue(DescriptionProperty);
            set => SetValue(DescriptionProperty, value);
        }

        public static readonly DependencyProperty DescriptionProperty =
            DependencyProperty.Register(
                nameof(Description),
                typeof(string),
                typeof(PropertyBox),
                new PropertyMetadata(string.Empty));

        public UIElement? Icon
        {
            get => (UIElement?)GetValue(IconProperty);
            set => SetValue(IconProperty, value);
        }

        public static readonly DependencyProperty IconProperty =
            DependencyProperty.Register(
                nameof(Icon),
                typeof(UIElement),
                typeof(PropertyBox),
                new PropertyMetadata(null));

    }
}
