using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
using System.Security;

namespace Connected.Components;

public partial class AppBar : UIComponent
{
	/// <summary>
	/// The classlist determining the toolbar render.
	/// </summary>
	private CssBuilder CompiledToolbarClassList
	{
		get
		{
			return new CssBuilder("toolbar-appbar")
				.AddClass(ToolbarClassList);
		}
	}

	/// <summary>
	/// The classlist determining the header render.
	/// </summary>
	private CssBuilder CompiledHeaderClassList
	{
		get
		{
			return new CssBuilder("app-bar")
				.AddClass($"appbar-fixed-top", Fixed && VerticalAlignment == VerticalAlignment.Top)
				.AddClass($"appbar-fixed-bottom", Fixed && VerticalAlignment == VerticalAlignment.Bottom)
				.AddClass(HeaderClassList);
		}
	}

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

	/// <summary>
	/// If true, appbar will be fixed.
	/// </summary>
	[Parameter]
	public bool Fixed { get; set; } = true;

	/// <summary>
	/// Class names for the AppBar header. In case of several, separate by spaces.
	/// </summary>
	[Parameter]
	public string? HeaderClassList { get; set; }

	/// <summary>
	/// Class names for the nested toolbar. In case of several, separate by spaces.
	/// </summary>
	[Parameter]
	public string? ToolbarClassList { get; set; }

	/// <summary>
	/// Determines the vertical alignment of the AppBar.
	/// </summary>
	[Parameter]
	public VerticalAlignment VerticalAlignment { get; set; }
}
