{namespace poi=Newland\Toubiz\Poi\Neos\ViewHelpers}
{namespace vh=Newland\NeosViewHelpers\ViewHelpers}

<poi:link.article
    article="{article}"
    class="tb-teaser"
    additionalAttributes="{
        itemscope: 'itemscope',
        itemtype: 'http://schema.org/LodgingBusiness',
        itemid: 'urn:uuid:{article.persistenceObjectIdentifier}'
    }">

    <f:render partial="PointOfInterests/Teaser/Common/Image" arguments="{_all}"/>

    <meta itemprop="address" content="{article.mainAddress.country} {article.mainAddress.zip} {article.mainAddress.city} {article.mainAddress.street}" />
    <div class="tb-teaser__text">
        <f:render partial="PointOfInterests/Teaser/Common/Topline" arguments="{_all}"/>
        <f:if condition="{article.flatAttributes.minimumBasePrice.0}">
            <p>
                <strong class="font-bold" itemprop="priceRange">
                    <vh:translate
                        id="price.word.todayFrom"
                        package="Newland.Toubiz.Poi.Neos"
                        source="Views/Teaser" />

                    <f:render
                        section="Currency"
                        arguments="{
                            currency: article.flatAttributes.minimumBasePrice.0.currency,
                            value: article.flatAttributes.minimumBasePrice.0.value
                        }" />

                    <meta itemprop="currenciesAccepted" content="{article.flatAttributes.minimumBasePrice.0.currency}" />
                </strong>

                {article.flatAttributes.minimumBasePrice.0.unit}
            </p>
        </f:if>

        <f:if condition="{article.starClassification} > 0 || {article.averageRating} > 0">
            <f:then>
                <f:render
                    partial="PointOfInterests/Attribute"
                    arguments="{
                        type: 'teaserRating',
                        name: 'teaserRating',
                        starClassification: article.starClassification,
                        averageRating: article.averageRating,
                        numberOfRatings: article.numberOfRatings
                    }" />

            </f:then>
        </f:if>
    </div>
</poi:link.article>


<f:section name="Currency">
    <f:switch expression="{currency}">
        <f:case value="CHF">
            <f:format.currency currencySign="CHF" decimalSeparator="." thousandsSeparator="'" prependCurrency="TRUE">{value}</f:format.currency>
        </f:case>

        <f:case value="EUR">
            <f:format.currency currencySign="€">{value}</f:format.currency>
        </f:case>

        <f:defaultCase>
            <f:format.currency currencySign="{currency}">{value}</f:format.currency>
        </f:defaultCase>
    </f:switch>
</f:section>
