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

namespace Connected.Components;

public partial class InputLabel : UIComponent
{
   protected string Classname =>
  new Utilities.CssBuilder()
    .AddClass("input-label")
    .AddClass("input-label-animated")
    .AddClass($"input-label-{Variant.ToDescription()}")
    .AddClass($"input-label-margin-{Margin.ToDescription()}", when: () => Margin != Margin.None)
    .AddClass($"disabled", Disabled)
    .AddClass("input-error", Error)
    .AddClass(AdditionalClassList)
  .Build();

   /// <summary>
   /// Child content of component.
   /// </summary>
   [Parameter] public RenderFragment ChildContent { get; set; }

   /// <summary>
   /// If true, the input element will be disabled.
   /// </summary>
   [Parameter] public bool Disabled { get; set; }

   /// <summary>
   /// If true, the label will be displayed in an error state.
   /// </summary>
   [Parameter] public bool Error { get; set; }

   /// <summary>
   /// Variant to use.
   /// </summary>
   [Parameter] public Variant Variant { get; set; } = Variant.Text;

   /// <summary>
   ///  Will adjust vertical spacing. 
   /// </summary>
   [Parameter] public Margin Margin { get; set; } = Margin.None;

   /// <summary>
   ///  Will set the for attribute for WCAG accessiblility
   /// </summary>
   [Parameter] public string ForId { get; set; } = string.Empty;
}
