{# @var travel_program \AppBundle\Entity\TravelProgram #}
<travel>
    <title>{{ travel_program.title }}</title>
    <url>{{ base_url }}{{ travel_program.page.urlPath }}</url>
    <locations>
        {% for country in travel_program.countries %}
            {% if country.destinations is empty %}
                <location>
                    <country>{{ country.name }}</country>
                </location>
            {% else %}
                {% for destination in country.destinations %}
                    <location>
                        <country>{{ country.name }}</country>
                        <region>{{ destination.name }}</region>
                        {# Actually <city> instead of <region>, but combination of city + country is not allowed #}
                    </location>
                {% endfor %}
            {% endif %}
        {% endfor %}
    </locations>
    <types>
        <type>Rundreisen</type>
        <type>Kulturreisen</type>
        <type>Tagesprogramm</type>
        {% if travel_program.programCode in ['AEGYST001', 'AEGYST002', 'AEGYST003', 'AEGYST004', 'AEGYST005',
            'AEGYST006', 'AEGYST008']
        %}
            <type>Kreuzfahrten</type>
        {% endif %}
    </types>
    <accommodation>Hotel</accommodation>
    <transport>Flugzeug</transport>
    <duration>{{ travel_program.programDuration }}</duration>
    <price_from>{{ travel_program.lowestPrice }}</price_from>
    <description_short>{{ subtitle }}</description_short>
    <min_traveler_count>{{ 5 in travel_program.countries.keys ? 2 : 1 }}</min_traveler_count>
    <max_traveler_count>{{ 6 in travel_program.countries.keys ? 26 : 12 }}</max_traveler_count>
    <description_long>
        {% filter escape('html') %}
            {{ html_description|raw }}
            {% if included is not empty %}
                <p><b>Leistungen inklusive</b></p>
                <ul>
                    {% for travel_program_service in included|split('\n') %}
                        <li>{{ travel_program_service|raw }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
            {% if travel_program.excluded is not empty %}
                <p><b>Nicht eingeschlossene / zubuchbare Leistungen</b></p>
                <ul>
                    {% for option in travel_program.options %}
                        <li>
                            {{ option.name }}<br/>
                            <small>{{ option.description|raw }}</small>
                        </li>
                    {% endfor %}
                </ul>
            {% endif %}
            {% if advices is not empty %}
                <p><b>Hinweise</b></p>
                <ul>
                    {% for travel_program_advice in advices|trim|split('\n') %}
                        <li>{{ travel_program_advice|raw }}</li>
                    {% endfor %}
                </ul>
            {% endif %}
        {% endfilter %}
    </description_long>
    <images>
        {% for image in travel_program.images %}
            <image>{{ base_url }}/uploads/travel_program/{{ image.fileNameWithExtension }}</image>
        {% endfor %}
    </images>
    <price_list>
        {% for travel_date in travel_program.travelDates if 3 in travel_date.prices|keys %}
            <row>
                <start_date>{{ travel_date.start|date('Y-m-d') }}</start_date>
                <end_date>{{ travel_date.end|date('Y-m-d') }}</end_date>
                <status>{{ travel_date.status }}</status>
                {% for price in travel_date.prices %}
                    {% if price.priceTypeId == 1 %}
                        <pricePerPerson>{{ price.effectiveDiscountPrice ?? price.effectivePrice }}</pricePerPerson>
                    {% elseif price.priceTypeId == 3 %}
                        <singleRoomPricePerPerson>{{ price.effectiveDiscountPrice ?? price.effectivePrice }}</singleRoomPricePerPerson>
                    {% endif %}
                {% endfor %}
                <excluded_services>
                    {% for departure in travel_date.departures %}
                        <service>
                            <name>
                                {{ departure.name|lower == 'eigenanreise' ? 'Eigenanreise' : ('Kosten Abflug ' ~ departure.name) }}
                            </name>
                            <price_single>{{ departure.extraCharge }}</price_single>
                            <type>departure</type>
                            <group>departure</group>
                        </service>
                    {% endfor %}
                </excluded_services>
            </row>
        {% endfor %}
    </price_list>
    <included_services>
        {% for travel_program_service in travel_program.included|split('\n') %}
            <service>{{ travel_program_service }}</service>
        {% endfor %}
    </included_services>
    <excluded_services>
        {% for option in travel_program.options %}
            <service>
                <name>{{ option.name }}</name>
                <description>{{ option.description }}</description>
                <price_single>{{ option.price }}</price_single>
                <price_children>{{ option.priceChildren }}</price_children>
            </service>
        {% endfor %}
    </excluded_services>
</travel>