{namespace neos=Neos\Neos\ViewHelpers}
{namespace nvh=Newland\NeosViewHelpers\ViewHelpers}
{namespace poi=Newland\Toubiz\Poi\Neos\ViewHelpers}
{namespace components=Newland\NeosCommon\ViewHelpers}
{namespace common=Newland\Toubiz\Common\Neos\ViewHelpers}

<f:layout name="Default"/>

<f:section name="Content">
    <common:slot.render slot="aboveDetail" context="{ article: article }" />
    <f:if condition="{article}">
        <f:then>
            <f:if condition="{article.isAttraction}">
                <f:then>
                    <article
                        itemscope
                        itemtype="http://schema.org/TouristAttraction"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="InnerContent" arguments="{_all}"/>
                    </article>
                </f:then>

                <f:else if="{article.isGastronomy}">
                    <article
                        itemscope
                        itemtype="http://schema.org/FoodEstablishment"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="InnerContent" arguments="{_all}"/>
                    </article>
                </f:else>

                <f:else if="{article.isTour}">
                    <article
                        itemscope
                        itemtype="http://schema.org/TravelAction"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="InnerContent" arguments="{_all}"/>
                    </article>
                </f:else>

                <f:else if="{article.isDirectMarketer}">
                    <article
                        itemscope
                        itemtype="http://schema.org/Store"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="InnerContent" arguments="{_all}"/>
                    </article>
                </f:else>

                <f:else if="{article.isOffer}">
                    <article
                        itemscope
                        itemtype="http://schema.org/Offer"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="InnerContent" arguments="{_all}"/>
                    </article>
                </f:else>

                <f:else if="{article.isCity}">
                    <article
                        itemscope
                        itemtype="http://schema.org/City"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="CityInnerContent" arguments="{_all}"/>
                    </article>
                </f:else>

                <f:else>
                    <article
                        itemscope
                        itemtype="http://schema.org/Place"
                        itemid="urn:uid:{article.persistenceObjectIdentifier}">

                        <nvh:render section="InnerContent" arguments="{_all}"/>
                    </article>
                </f:else>
            </f:if>
        </f:then>
        <f:else>
            <f:if condition="{neos:rendering.inBackend(node: node)}">
                <p>No article selected.</p>
            </f:if>
        </f:else>
    </f:if>
    <common:slot.render slot="belowDetail" context="{ article: article }" />
</f:section>

<f:section name="InnerContent">
    <meta itemprop="mainEntityOfPage" content="{url}"/>

    <common:slot.render slot="aboveTitle" context="{ article: article }" />
    <header class="mb-8">
        <nvh:render partial="PointOfInterests/Show/Header" arguments="{_all}"/>
    </header>
    <common:slot.render slot="belowTitle" context="{ article: article }" />

    <f:if condition="{article.mediaSorted -> f:count()} > 2">
        <common:slot.render slot="aboveDetailGallery" context="{ article: article }" />
        <components:gallery
            wrapperClass="mb-10"
            images="{article.imagesSorted}"
            videos="{article.videosSorted}"
            flight3dUri="{article.flatAttributes.flight3d}"
            panoramaUri="{article.flatAttributes.panorama}"
        />
        <common:slot.render slot="belowDetailGallery" context="{ article: article }" />
    </f:if>

    <div class="mb-20">
        <div class="tb-layout-detail">
            <section class="tb-layout-detail__main">
                <common:slot.render slot="aboveDetailMainContent" context="{ article: article }" />
                <nvh:render partial="PointOfInterests/Show/Main" arguments="{_all}"/>
                <common:slot.render slot="belowDetailMainContent" context="{ article: article }" />
            </section>

            <section class="tb-layout-detail__sidebar-last">
                <common:slot.render slot="aboveDetailAside" context="{ article: article }" />
                <nvh:render partial="PointOfInterests/Show/Aside" arguments="{_all}"/>
                <common:slot.render slot="belowDetailAside" context="{ article: article }" />
            </section>
        </div>
    </div>

    <div>
        <nvh:render partial="PointOfInterests/Show/Appendix" arguments="{_all}"/>
    </div>
</f:section>

<f:section name="CityInnerContent">
    <meta itemprop="mainEntityOfPage" content="{url}"/>

    <common:slot.render slot="aboveTitle" context="{ article: article }" />
    <header class="mb-8">
        <nvh:render partial="PointOfInterests/Show/Header" arguments="{_all}"/>
    </header>
    <common:slot.render slot="belowTitle" context="{ article: article }" />

    <f:if condition="{article.mediaSorted -> f:count()} > 2 && !{insertGalleryAfterLinks}">
        <components:gallery
            wrapperClass="mb-10"
            images="{article.imagesSorted}"
            videos="{article.videosSorted}"
        />
    </f:if>

    <div class="mb-12">
        <div class="tb-layout-detail">
            <section class="tb-layout-detail__main">
                <common:slot.render slot="aboveDetailMainContent" context="{ article: article }" />
                <nvh:render partial="PointOfInterests/Show/Main" arguments="{_all}"/>
                <common:slot.render slot="belowDetailMainContent" context="{ article: article }" />
            </section>

            <section class="tb-layout-detail__sidebar-last">
                <common:slot.render slot="aboveDetailAside" context="{ article: article }" />
                <nvh:render partial="PointOfInterests/Show/Aside" arguments="{_all}"/>
                <common:slot.render slot="belowDetailAside" context="{ article: article }" />
            </section>
        </div>
    </div>

    <div>
        <nvh:render partial="PointOfInterests/Show/Appendix" arguments="{_all}"/>
    </div>
</f:section>
