@inherits Dynamicweb.Rendering.ViewModelTemplate<Dynamicweb.Frontend.ParagraphViewModel>
@using Dynamicweb.Ecommerce.ProductCatalog
@using System.Collections.Generic

@{
	var groups = GetViewParameter("Groups") as List<FieldGroupViewModel>;
	bool hideGroupHeaders = GetViewParameterBoolean("HideGroupHeaders");
	bool hideTitle = GetViewParameterBoolean("HideTitle");
	string size = GetViewParameterString("Size");
	
	string title = Model.Item.GetString("Title");
	bool hideLabels = Model.Item.GetBoolean("HideFieldLabels");
	string titleFontSize = Model.Item.GetRawValueString("TitleFontSize", "display-4");
	string listSize = size == "full" ? "" : "m-0 p-0 lh-1 fs-7 opacity-75";
	string listStyle = size == "full" ? "" : "style=\"list-style-position: inside\"";

	if (!hideTitle)
	{
		<h2 class="g-col-12 @titleFontSize">@title</h2>
	}

	<div class="g-col-12">
		@foreach (var group in groups)
		{

			if (!hideGroupHeaders)
			{
				<h3>@group.Name</h3>
			}

			<ul class="@listSize" @listStyle>
				@foreach (var field in group.Fields)
				{

					<li>
						@if (!hideLabels)
						{
							<strong>@field.Name: </strong>
						}			
						<span>@RenderPartial("Components/Specifications/Shared/FieldValue.cshtml", field)</span>
					</li>

				}
			</ul>

		}
	</div>
}
