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

namespace Connected.Components;

public partial class Fab : ButtonBase
{
	protected string Classname =>
	new CssBuilder("button-root mud-fab")
	  .AddClass($"fab-extended", !string.IsNullOrEmpty(Label))
	  .AddClass($"fab-{Color.ToDescription()}")
	  .AddClass($"fab-size-{Size.ToDescription()}")
	.Build();

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

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

	/// <summary>
	/// If applied Glyph will be added at the start of the component.
	/// </summary>
	[Obsolete("This property is obsolete. Use StartIcon instead.")][Parameter] public string Icon { get => StartIcon; set => StartIcon = value; }

	/// <summary>
	/// If applied Glyph will be added at the start of the component.
	/// </summary>
	[Parameter]
	[Category(CategoryTypes.Button.Behavior)]
	public string StartIcon { get; set; }

	/// <summary>
	/// If applied Glyph will be added at the end of the component.
	/// </summary>
	[Parameter]
	[Category(CategoryTypes.Button.Behavior)]
	public string EndIcon { get; set; }

	/// <summary>
	/// The color of the icon. It supports the theme colors.
	/// </summary>
	[Parameter]
	[Category(CategoryTypes.Button.Appearance)]
	public ThemeColor IconColor { get; set; } = ThemeColor.Inherit;

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

	/// <summary>
	/// If applied the text will be added to the component.
	/// </summary>
	[Parameter]
	[Category(CategoryTypes.Button.Behavior)]
	public string Label { get; set; }

	/// <summary>
	/// GlyphTitle of the icon used for accessibility.
	/// </summary>
	[Parameter]
	[Category(CategoryTypes.Button.Behavior)]
	public string Title { get; set; }
}
