// Copyright (c) MudBlazor 2021
// MudBlazor licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

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

namespace Connected.Components;

public partial class Paper : UIComponent
{
   protected string Classname =>
   new CssBuilder("paper")
     .AddClass($"paper-outlined", Outlined)
     .AddClass($"paper-square", Square)
     .AddClass($"elevation-{Elevation.ToString()}", !Outlined)
     .AddClass(AdditionalClassList)
   .Build();

   protected string Stylename =>
   new StyleBuilder()
      .AddStyle("height", $"{Height}", !String.IsNullOrEmpty(Height))
      .AddStyle("width", $"{Width}", !String.IsNullOrEmpty(Width))
      .AddStyle("max-height", $"{MaxHeight}", !String.IsNullOrEmpty(MaxHeight))
      .AddStyle("max-width", $"{MaxWidth}", !String.IsNullOrEmpty(MaxWidth))
      .AddStyle("min-height", $"{MinHeight}", !String.IsNullOrEmpty(MinHeight))
      .AddStyle("min-width", $"{MinWidth}", !String.IsNullOrEmpty(MinWidth))
   .Build();

   /// <summary>
   /// The higher the number, the heavier the drop-shadow.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public int Elevation { set; get; } = 1;

   /// <summary>
   /// If true, border-radius is set to 0.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public bool Square { get; set; }

   /// <summary>
   /// If true, card will be outlined.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public bool Outlined { get; set; }

   /// <summary>
   /// Height of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public string Height { get; set; }

   /// <summary>
   /// Width of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public string Width { get; set; }

   /// <summary>
   /// Max-Height of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public string MaxHeight { get; set; }

   /// <summary>
   /// Max-Width of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public string MaxWidth { get; set; }

   /// <summary>
   /// Min-Height of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public string MinHeight { get; set; }

   /// <summary>
   /// Min-Width of the component.
   /// </summary>
   [Parameter]
   [Category(CategoryTypes.Paper.Appearance)]
   public string MinWidth { get; set; }

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