{#
/**
 * @file
 *
 * Default product template.
 *
 * Available variables:
 * - attributes: HTML attributes for the wrapper.
 * - product: The rendered product fields.
 *   Use 'product' to print them all, or print a subset such as
 *   'product.title'. Use the following code to exclude the
 *   printing of a given field:
 *   @code
 *   {{ product|without('title') }}
 *   @endcode
 * - product_entity: The product entity.
 * - product_url: The product URL.
 * - title_prefix: Additional output populated by modules, intended to be
 *   displayed in front of the main title tag that appears in the template.
 * - title_suffix: Additional output populated by modules, intended to be
 *   displayed after the main title tag that appears in the template.
 *
 * @ingroup themeable
 */
#}
{{ attach_library('kamihaya_digitalagency/product-details') }}

<article{{ attributes.addClass('product-details') }}>
  {{ title_prefix }}
  {{ title_suffix }}

  {# Category #}
  {% if product.field_category|render %}
  <div class="product-category">
    {{- product.field_category -}}
  </div>
  {% endif %}

  {% set display_description = product.field_display_description|render|striptags|trim|lower %}
  {% if product.field_thumbnail_image|render or display_description == 'true' and product.field_description|render %}
    <div class="product-overview">
  {% endif %}

  {# Thumbnail #}
  {% if product.field_thumbnail_image|render %}
    <div class="product-thumbnail">
      {{- product.field_thumbnail_image -}}
    </div>
  {% endif %}

  {# Description #}
  {% if display_description == 'true' and product.field_description|render %}
    <div class="product-description">
     {{- product.field_description -}}
    </div>
  {% endif %}

  {% if product.field_thumbnail_image|render or display_description == 'true' and product.field_description|render %}
	  </div>
	{% endif %}

  {# Product contents #}
  {% if product.field_body|render %}
  <div class="product-contents">
    {{ product.field_body }}
  </div>
  {% endif %}
  {# {{- product|without('variation_attributes') -}} #}
</article>
