using Connected.Annotations;
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;

namespace Connected.Components;

public partial class ButtonGroup : UIComponent
{
   protected string Classname =>
   new CssBuilder("button-group-root")
     .AddClass($"button-group-override-styles", OverrideStyles)
     .AddClass($"button-group-{Variant.ToDescription()}")
     .AddClass($"button-group-{Variant.ToDescription()}-{Color.ToDescription()}")
     .AddClass($"button-group-{Variant.ToDescription()}-size-{Size.ToDescription()}")
     .AddClass($"button-group-vertical", VerticalAlign)
     .AddClass($"button-group-horizontal", !VerticalAlign)
     .AddClass($"button-group-disable-elevation", DisableElevation)
     .AddClass($"button-group-rtl", RightToLeft)
     .AddClass(AdditionalClassList)
   .Build();


   [CascadingParameter(Name = "RightToLeft")]
   public bool RightToLeft { get; set; }

   /// <summary>
   /// If true, the button group will override the styles of the individual buttons.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Appearance)]
   public bool OverrideStyles { get; set; } = true;

   /// <summary>
   /// Child content of component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Behavior)]
   public RenderFragment ChildContent { get; set; }

   /// <summary>
   /// If true, the button group will be displayed vertically.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Appearance)]
   public bool VerticalAlign { get; set; } = false;

   /// <summary>
   /// If true, no drop-shadow will be used.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Appearance)]
   public bool DisableElevation { get; set; } = false;

   /// <summary>
   /// The color of the component. It supports the theme colors.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Appearance)]
   public ThemeColor Color { get; set; } = ThemeColor.Default;

   /// <summary>
   /// The size of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Appearance)]
   public Size Size { get; set; } = Size.Medium;

   /// <summary>
   /// The variant to use.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.ButtonGroup.Appearance)]
   public Variant Variant { get; set; } = Variant.Text;
}
