{%- set document_config = view_object.document.config -%}

{%- if document_config.has_meta() or document_config.has_custom_metadata() -%}
  <sdoc-meta>
    {%- if view_object.document.config.uid -%}
    <sdoc-meta-label data-testid="document-config-uid-label">UID:</sdoc-meta-label>
    <sdoc-meta-field data-testid="document-config-uid-field">
      {%- with field_content = view_object.document.config.uid %}
        {%- include "components/field/index.jinja" -%}
      {%- endwith -%}
    </sdoc-meta-field>
    {%- endif -%}

    {% set document_version_ = view_object.render_document_version() %}
    {%- if document_version_ is not none -%}
    <sdoc-meta-label data-testid="document-config-version-label">VERSION:</sdoc-meta-label>
    <sdoc-meta-field data-testid="document-config-version-field">
      {%- with field_content = document_version_ %}
        {%- include "components/field/index.jinja" -%}
      {%- endwith -%}
    </sdoc-meta-field>
    {# FIXME: Task #1229 / Uncomment example when validation logic is implemented: #}
    {#
      {% with issue_field_name = 'meta' %}
        {% include "components/issue/index.jinja" %}
      {% endwith %}
    #}
    {%- endif -%}

    {% set document_date_ = view_object.render_document_date() %}
    {%- if document_date_ is not none -%}
    <sdoc-meta-label data-testid="document-config-date-label">DATE:</sdoc-meta-label>
    <sdoc-meta-field data-testid="document-config-date-field">
      {%- with field_content = document_date_ %}
        {%- include "components/field/index.jinja" -%}
      {%- endwith -%}
    </sdoc-meta-field>
    {%- endif -%}

    {%- if view_object.document.config.classification -%}
    <sdoc-meta-label data-testid="document-config-classification-label">CLASSIFICATION:</sdoc-meta-label>
    <sdoc-meta-field data-testid="document-config-classification-field">
      {%- with field_content = view_object.document.config.classification %}
        {%- include "components/field/index.jinja" -%}
      {%- endwith -%}
    </sdoc-meta-field>
    {%- endif -%}

    {%- if document_config.has_custom_metadata() -%}
    {% for key, value in document_config.get_custom_metadata() %}
    <sdoc-meta-label data-testid="document-config-metadata-label">{{key}}:</sdoc-meta-label>
    <sdoc-meta-field data-testid="document-config-metadata-field">
      <sdoc-autogen>{{ value }}</sdoc-autogen>
    </sdoc-meta-field>
    {% endfor %}
    {% endif %}

  </sdoc-meta>
{%- endif -%}
