{% macro makeItem(
  parts,
  child_variant,
  item,
  pid,
  toggle,
  child_content_class,
  child_content_attributes,
  child_link_class,
  child_link_attributes,
  show_close,
  scroll_to ) %}

  {% set item_content = item.content%}
  {% if item.children %}
    {% set item_content %}
      {{ item.content }}
      {% set child_vars = {
        'items': item.children,
        'pid': item.aiid,
        'wrapper_class': 'nestac'
      } %}
      {{ pattern('bs-accordion-items', child_vars, child_variant) }}
    {% endset %}
  {% endif %}

  {% if child_variant == '__default' %}
    {% set vars = {
      "aiid": item.aiid,
      "pid": pid,
      "label": item.label,
      "content": item_content,
      "toggle": toggle,
      "content_class": child_content_class,
      "content_attributes": child_content_attributes,
      "link_attributes": child_link_attributes,
      "link_class": child_link_class,
      "parts": parts,
      "show_close": show_close,
      "scroll_to": scroll_to,
      "active": item.active,
    } %}
    {% if item.tag_name is defined %}
      {% set vars = vars|merge({
        'tag_name': item.tag_name
      }) %}
    {% endif %}
  {% else %}
    {% set vars = {
      "aiid": item.aiid,
      "pid": pid,
      "label": item.label,
      "content": item_content,
      "parts": parts,
      "active": item.active,
      "scroll_to": scroll_to,
    } %}
    {% if item.tag_name is defined %}
      {% set vars = vars|merge({
        'tag_name': item.tag_name
      }) %}
    {% endif %}
  {% endif %}

  {{ pattern('bs-accordion-item', vars, child_variant) }}

{% endmacro %}
