{% import 'macros/authoritative_definitions.html' as ad_macros %}
{% set team = datacontract.team if datacontract.team is defined and datacontract.team is not callable else none %}
{% if team %}
{% set team_name = team.name if team.name is defined and team.name else none %}
{% set team_description = team.description if team.description is defined and team.description else none %}
{% set team_members = team.members if team.members is defined and team.members and team.members is sequence and team.members is not string else [] %}
{% set team_tags = team.tags if team.tags is defined and team.tags and team.tags is sequence and team.tags is not string else [] %}
{% set team_auth_defs = team.authoritativeDefinitions if team.authoritativeDefinitions is defined and team.authoritativeDefinitions and team.authoritativeDefinitions is sequence and team.authoritativeDefinitions is not string else [] %}
{% set team_custom_properties = team.customProperties if team.customProperties is defined else none %}
{% set has_data = team_name or team_description or (team_members|length > 0) or (team_tags|length > 0) or (team_auth_defs|length > 0) or team_custom_properties %}
{% if has_data %}
Team
This section lists team information and members
{% if team_auth_defs and team_auth_defs|length > 0 %}
{% endif %}
{% if team_tags and team_tags|length > 0 %}
Tags
{% for tag in team_tags %}
{{ tag }}
{% endfor %}
{% endif %}
{% if team_custom_properties %}
{% if team_custom_properties is mapping and team_custom_properties|length > 0 %}
Custom Properties
{% for key, value in team_custom_properties.items() %}
{{ key }}
{% if value is mapping or (value is sequence and value is not string) %}
{{ value | tojson }}
{% elif value is sameas true %}
true
{% elif value is sameas false %}
false
{% else %}
{{ value }}
{% endif %}
{% endfor %}
{% elif team_custom_properties is sequence and team_custom_properties is not string and team_custom_properties|length > 0 %}
Custom Properties
{% for cp in team_custom_properties %}
{% if cp.property is defined and cp.value is defined %}
{{ cp.property }}
{% if cp.description is defined and cp.description %}
ⓘ
{% endif %}
{% if cp.value is mapping or (cp.value is sequence and cp.value is not string) %}
{{ cp.value | tojson }}
{% elif cp.value is sameas true %}
true
{% elif cp.value is sameas false %}
false
{% else %}
{{ cp.value }}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% if team_members and team_members|length > 0 %}
Members
{% for member in team_members %}
{% set m_username = member.username if member.username is defined and member.username else none %}
{% set m_name = member.name if member.name is defined and member.name else none %}
{% set m_role = member.role if member.role is defined and member.role else none %}
{% set m_description = member.description if member.description is defined and member.description else none %}
{% set m_date_in = member.dateIn if member.dateIn is defined and member.dateIn else none %}
{% set m_date_out = member.dateOut if member.dateOut is defined and member.dateOut else none %}
{% set m_replaced_by = member.replacedByUsername if member.replacedByUsername is defined and member.replacedByUsername else none %}
{% set m_tags = member.tags if member.tags is defined and member.tags and member.tags is sequence and member.tags is not string else [] %}
{% set m_auth_defs = member.authoritativeDefinitions if member.authoritativeDefinitions is defined and member.authoritativeDefinitions and member.authoritativeDefinitions is sequence and member.authoritativeDefinitions is not string else [] %}
{% set m_custom_props = member.customProperties if member.customProperties is defined else none %}
{% set has_member_data = m_username or m_name or m_role or m_description or m_date_in or m_date_out or m_replaced_by or (m_tags|length > 0) or (m_auth_defs|length > 0) or m_custom_props %}
{% if m_username %}
{{ m_username }}
{% endif %}
{% if m_name %}
{{ m_name }}
{% endif %}
{% if m_role %}
{{ m_role }}
{% endif %}
{% if m_description %}
{{ m_description }}
{% endif %}
{% if m_date_in or m_date_out or m_replaced_by %}
{% if m_date_in %}
Date in: {{ m_date_in }}
{% endif %}
{% if m_date_out %}
Date out: {{ m_date_out }}
{% endif %}
{% if m_replaced_by %}
Replaced by: {{ m_replaced_by }}
{% endif %}
{% endif %}
{% if m_tags and m_tags|length > 0 %}
{% for tag in m_tags %}
{{ tag }}
{% endfor %}
{% endif %}
{% set has_member_refs = (m_auth_defs|length > 0) %}
{% set has_member_cp = (m_custom_props is mapping and m_custom_props|length > 0) or (m_custom_props is sequence and m_custom_props is not string and m_custom_props|length > 0) %}
{% if has_member_refs or has_member_cp %}
{% if has_member_refs %}
{% for definition in m_auth_defs %}
{{ ad_macros.icon_for(definition) }}
{{ definition.type }}
{% endfor %}
{% endif %}
{% if has_member_cp %}
{% if m_custom_props is mapping %}
{% for key, value in m_custom_props.items() %}
{{ key }}:{% if value is sameas true %}true{% elif value is sameas false %}false{% elif value is mapping or (value is sequence and value is not string) %}{{ value|tojson }}{% else %}{{ value }}{% endif %}
{% endfor %}
{% elif m_custom_props is sequence and m_custom_props is not string %}
{% for cp in m_custom_props %}
{% if cp.property is defined and cp.value is defined %}
{{ cp.property }}:{% if cp.value is sameas true %}true{% elif cp.value is sameas false %}false{% elif cp.value is mapping or (cp.value is sequence and cp.value is not string) %}{{ cp.value|tojson }}{% else %}{{ cp.value }}{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endif %}