package org.xbib.io.webdav.client;

import org.xbib.io.webdav.api.DavConstants;
import org.xbib.io.webdav.common.DavPropertyName;
import org.xbib.io.webdav.api.Namespace;

/**
 * <code>SearchConstants</code> interface provide constants for request
 * and response headers, Xml elements and property names used for WebDAV
 * search.
 */
public interface SearchConstants {

    /**
     * Namespace definition.<br>
     * NOTE: For convenience reasons, the namespace is defined to be the default
     * {@link  DavConstants#NAMESPACE DAV:} namespace. This is not correct for the
     * underlying specification is still in a draft state. See also the editorial
     * note inside the
     * <a href="http://greenbytes.de/tech/webdav/draft-reschke-webdav-search-latest.html#rfc.section.1.5">Internet Draft WebDAV Search</a>
     * document.
     */
    Namespace NAMESPACE = DavConstants.NAMESPACE;

    /**
     * Predefined basic query grammer.
     */
    String BASICSEARCH = NAMESPACE.getPrefix() + "basicsearch";

    /**
     * The DASL response header specifying the query languages supported by
     * the requested resource.
     */
    String HEADER_DASL = "DASL";

    /**
     * Xml element name for a single query grammar element inside
     * the {@link #QUERY_GRAMMER_SET supported-query-grammer-set property}.
     */
    String XML_QUERY_GRAMMAR = "supported-query-grammar";

    /**
     * Name constant for the 'DAV:grammar' element, which is used inside the
     * {@link #XML_QUERY_GRAMMAR} element.
     */
    String XML_GRAMMER = "grammar";

    /**
     * Xml element name for the required request body of a SEARCH request.
     *
     * @see SearchInfo
     * @see SearchResource#search(SearchInfo)
     */
    String XML_SEARCHREQUEST = "searchrequest";

    /**
     * Optional Xml element name used in the SEARCH request body instead of {@link #XML_SEARCHREQUEST}
     * in order to access a given query schema.
     */
    String XML_QUERY_SCHEMA_DISCOVERY = "query-schema-discovery";

    /**
     * Property indicating the set of query languages the given resource is
     * able deal with. The property has the following definition:<br>
     * <pre>
     * &lt;!ELEMENT supported-query-grammar-set (supported-query-grammar*)&gt;
     * &lt;!ELEMENT supported-query-grammar grammar&gt;
     * &lt;!ELEMENT grammar ANY&gt;
     * </pre>
     */
    DavPropertyName QUERY_GRAMMER_SET = DavPropertyName.create("supported-query-grammar-set", NAMESPACE);
}