@using Wave.Utilities
@using Wave.Data
@using System.Net

<!-- badge badge-info badge-warning badge-error badge-primary badge-secondary badge-neutral badge-accent -->
@if (HasCategoryLink) {
	<a href="/category/@WebUtility.UrlEncode(Category.Name)" class="badge badge-@CategoryUtilities.GetCssClassPostfixForColor(Category.Color)" @attributes="AdditionalAttributes">
		@Category.Name
	</a>
} else {
	<span class="badge badge-@CategoryUtilities.GetCssClassPostfixForColor(Category.Color)" @attributes="AdditionalAttributes">
		@Category.Name
	</span>
}

@code {
	[Parameter]
	public required Category Category { get; set; }
	[Parameter]
	public bool HasCategoryLink { get; set; } = true;
	[Parameter(CaptureUnmatchedValues = true)]
	public Dictionary<string, object>? AdditionalAttributes { get; set; }
}