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

@{
	ProductViewModel product = null;
	if (Dynamicweb.Context.Current.Items.Contains("ProductDetails"))
	{
		product = (ProductViewModel)Dynamicweb.Context.Current.Items["ProductDetails"];
	} else if (Pageview.IsVisualEditorMode) {
		product = new ProductViewModel();
		product.Name = Translate("My product");
	}
}

@if (product is object)
{
	string titleFontSize = Model.Item.GetRawValueString("FontSize", "fs-6");
	string horizontalAlign = Model.Item.GetRawValueString("HorizontalAlignment", "");
	horizontalAlign = horizontalAlign == "center" ? "text-center" : horizontalAlign;
	horizontalAlign = horizontalAlign == "end" ? "text-end" : horizontalAlign;

	string headingLevel = Model.Item.GetString("HeadingLevel", "h2");
	string headingLevelStart = $"<{headingLevel} class=\"{titleFontSize} {horizontalAlign} m-0 item_{Model.Item.SystemName.ToLower()}\" itemprop=\"name\">";
	string headingLevelStop = $"</{headingLevel}>";

	@headingLevelStart
	@product.Name
	@headingLevelStop
}
