<data>
	<organization>
		<name>${organizationData.name}</name>
		<address>${organizationData.mainContact.address}</address>
	</organization>
    <#list participantsData as participant>
        <@printParticipant participant />
    </#list>
</data>

<#macro printParticipant participant>
    <#local participantInfo = participantInfos?api.get(participant.id)>
    <#local assets = participantAssets?api.get(participant.id)>
	<#if assets?has_content>
        <#local jedinec = ParticipantFunctions.getAssetByFunction(assets, 'Jedinec')>
    </#if>

	<participant>
		<jedinec>
			<name><#if jedinec??>${jedinec.name!""}</#if></name>
			<number><#if jedinec??>${jedinec.number!""}</#if></number>
			<chip><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'Číslo čipu')}</#if></chip>
			<birthday><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'Datum narození')}</#if></birthday>
			<breed><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'Plemeno')}</#if></breed>
			<sex><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'Pohlaví')}</#if></sex>
			<color><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'Barva')}</#if></color>
			<hd><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'HD')}</#if></hd>
			<ed><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'ED')}</#if></ed>
			<ocd><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'OCD')}</#if></ocd>
			<ecvo><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'ECVO')}</#if></ecvo>
            <#if jedinec??>
                <#local jedinecMembers = assetMembers?api.get(jedinec.id)![]>
                <#if ParticipantFunctions.getAssetMemberByType(jedinecMembers, 'Majitel')??>
                    <#local jedinecOwner = ParticipantFunctions.getAssetMemberByType(jedinecMembers, 'Majitel')>
                    <#if jedinecOwner?has_content>
                        <#local jedinecOwnerContact = ParticipantFunctions.getContactByType(jedinecOwner.contacts, 'Kontaktní adresa')>
                    </#if>
                </#if>
                <#if ParticipantFunctions.getAssetMemberByType(jedinecMembers, 'Spolumajitel')??>
                    <#local jedinecCoowner = ParticipantFunctions.getAssetMemberByType(jedinecMembers, 'Spolumajitel')>
                </#if>
            </#if>
			<owner>
				<name><#if jedinecOwner??>${jedinecOwner.name!""}</#if></name>
				<address><#if jedinecOwnerContact??>${jedinecOwnerContact.address}</#if></address>
				<chs><#if jedinec??>${ParticipantFunctions.getAssetAttributeValue(jedinec.renderedAttributes, 'CHS')}</#if></chs>
				<coowner><#if jedinecCoowner??>${jedinecCoowner.name!""}</#if></coowner>
			</owner>

		</jedinec>

		<vystaveno>${ParticipantFunctions.getInfoValue(participantInfo, 'Vystavení')}</vystaveno>

	</participant>
</#macro>