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

namespace Sonex.Client.Controls;

public sealed class PropertyBoxItemsExpander : ItemsControl
{
    private static readonly Style DefaultControlStyle = LoadDefaultStyle();

    public PropertyBoxItemsExpander()
    {
        Style = DefaultControlStyle;
    }

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

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

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

    public static readonly DependencyProperty TitleProperty =
        DependencyProperty.Register(
            nameof(Title),
            typeof(string),
            typeof(PropertyBoxItemsExpander),
            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(PropertyBoxItemsExpander),
            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(PropertyBoxItemsExpander),
            new PropertyMetadata(null));



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

    public static readonly DependencyProperty FooterProperty =
        DependencyProperty.Register(
            nameof(Footer),
            typeof(UIElement),
            typeof(PropertyBoxItemsExpander),
            new PropertyMetadata(null));



}
