<?xml version="1.0" encoding="UTF-8" ?>
<d:multistatus xmlns:d="DAV:">
    <d:response>
        <d:href>{{ path('chill_docstore_dav_document_get', {'uuid': stored_object.uuid, 'access_token': access_token}) }}</d:href>
        {% if properties.lastModified or properties.contentLength or properties.resourceType or properties.etag or properties.contentType or properties.creationDate %}
            <d:propstat>
                <d:prop>
                    {% if properties.resourceType %}
                        <d:resourcetype/>
                    {% endif %}
                    {% if properties.creationDate %}
                        <d:creationdate />
                    {% endif %}
                    {% if properties.lastModified %}
                        {%  if last_modified is not same as null %}
                            <d:getlastmodified>{{  last_modified.format(constant('DATE_RSS')) }}</d:getlastmodified>
                        {% else %}
                            <d:getlastmodified />
                        {% endif %}
                    {% endif %}
                    {% if properties.contentLength %}
                        {%  if content_length is not same as null %}
                        <d:getcontentlength>{{ content_length }}</d:getcontentlength>
                        {% else %}
                        <d:getcontentlength />
                        {% endif %}
                    {% endif %}
                    {% if properties.etag %}
                        {% if etag is not same as null %}
                            <d:getetag>"{{ etag }}"</d:getetag>
                        {% else %}
                            <d:getetag />
                        {% endif %}
                    {% endif %}
                    {% if properties.contentType %}
                        <d:getcontenttype>{{ stored_object.type }}</d:getcontenttype>
                    {% endif %}
                </d:prop>
                <d:status>HTTP/1.1 200 OK</d:status>
            </d:propstat>
        {% endif %}
        {% if properties.unknowns|length > 0 %}
            <d:propstat>
                {% for k,u in properties.unknowns %}
                    <d:prop {{ ('xmlns:ns' ~ k ~ '="' ~ u.xmlns|e('html_attr') ~ '"')|raw }}>
                        <{{ 'ns'~ k ~ ':' ~ u.prop }} />
                    </d:prop>
                {% endfor %}
                <d:status>HTTP/1.1 404 Not Found</d:status>
            </d:propstat>
        {% endif %}
    </d:response>
</d:multistatus>
