package org.xbib.io.webdav.api;

/**
 * <code>DavConstants</code> provide constants for request and response
 * headers, XML elements and property names defined by
 * <a href="http://www.webdav.org/specs/rfc2518.html">RFC 2518</a>. In addition,
 * common date formats (creation date and modification time) are included.
 */
public interface DavConstants {

    /**
     * Default Namespace constant
     */
    Namespace NAMESPACE = Namespace.getNamespace("D", "DAV:");

    String HEADER_DAV = "DAV";
    String HEADER_DESTINATION = "Destination";
    String HEADER_IF = "If";
    String HEADER_AUTHORIZATION = "Authorization";
    String HEADER_CONTENT_TYPE = "Content-Type";
    String HEADER_CONTENT_LENGTH = "Content-Length";
    String HEADER_CONTENT_LANGUAGE = "Content-Language";
    String HEADER_ETAG = "ETag";
    String HEADER_LAST_MODIFIED = "Last-Modified";

    String HEADER_LOCK_TOKEN = "Lock-Token";
    String OPAQUE_LOCK_TOKEN_PREFIX = "opaquelocktoken:";

    String HEADER_TIMEOUT = "Timeout";
    String TIMEOUT_INFINITE = "Infinite";
    // RFC 2518: timeout value for TimeType "Second" MUST NOT be greater than 2^32-1
    long INFINITE_TIMEOUT = Integer.MAX_VALUE;
    long UNDEFINED_TIMEOUT = Integer.MIN_VALUE;

    String HEADER_OVERWRITE = "Overwrite";

    String HEADER_DEPTH = "Depth";
    String DEPTH_INFINITY_S = "infinity";
    int DEPTH_INFINITY = Integer.MAX_VALUE;
    int DEPTH_0 = 0;
    int DEPTH_1 = 1;

    //---< XML Element, Attribute Names >---------------------------------------
    String XML_ALLPROP = "allprop";
    String XML_COLLECTION = "collection";
    String XML_DST = "dst";
    String XML_HREF = "href";
    String XML_INCLUDE = "include";
    String XML_KEEPALIVE = "keepalive";
    String XML_LINK = "link";
    String XML_MULTISTATUS = "multistatus";
    String XML_OMIT = "omit";
    String XML_PROP = "prop";
    String XML_PROPERTYBEHAVIOR = "propertybehavior";
    String XML_PROPERTYUPDATE = "propertyupdate";
    String XML_PROPFIND = "propfind";
    String XML_PROPNAME = "propname";
    String XML_PROPSTAT = "propstat";
    String XML_REMOVE = "remove";
    String XML_RESPONSE = "response";
    String XML_RESPONSEDESCRIPTION = "responsedescription";
    String XML_SET = "set";
    String XML_SOURCE = "source";
    String XML_STATUS = "status";

    String XML_ACTIVELOCK = "activelock";
    String XML_DEPTH = "depth";
    String XML_LOCKTOKEN = "locktoken";
    String XML_TIMEOUT = "timeout";
    String XML_LOCKSCOPE = "lockscope";
    String XML_EXCLUSIVE = "exclusive";
    String XML_SHARED = "shared";
    String XML_LOCKENTRY = "lockentry";
    String XML_LOCKINFO = "lockinfo";
    String XML_LOCKTYPE = "locktype";
    String XML_WRITE = "write";
    String XML_OWNER = "owner";
    /**
     * The <code>lockroot</code> XML element
     *
     * @see <a href="http://www.webdav.org/specs/rfc4918.html#ELEMENT_lockroot">RFC 4918</a>
     */
    String XML_LOCKROOT = "lockroot";

    /*
     * Webdav property names as defined by RFC 2518<br>
     * Note: Microsoft webdav clients as well as Webdrive request additional
     * property (e.g. href, name, owner, isRootLocation, isCollection)  within the
     * default namespace, which are are ignored by this implementation, except
     * for the 'isCollection' property, needed for XP built-in clients.
     */
    String PROPERTY_CREATIONDATE = "creationdate";
    String PROPERTY_DISPLAYNAME = "displayname";
    String PROPERTY_GETCONTENTLANGUAGE = "getcontentlanguage";
    String PROPERTY_GETCONTENTLENGTH = "getcontentlength";
    String PROPERTY_GETCONTENTTYPE = "getcontenttype";
    String PROPERTY_GETETAG = "getetag";
    String PROPERTY_GETLASTMODIFIED = "getlastmodified";
    String PROPERTY_LOCKDISCOVERY = "lockdiscovery";
    String PROPERTY_RESOURCETYPE = "resourcetype";
    String PROPERTY_SOURCE = "source";
    String PROPERTY_SUPPORTEDLOCK = "supportedlock";

    int PROPFIND_BY_PROPERTY = 0;
    int PROPFIND_ALL_PROP = 1;
    int PROPFIND_PROPERTY_NAMES = 2;
    int PROPFIND_ALL_PROP_INCLUDE = 3; // RFC 4918, Section 9.1

    /**
     * Marker for undefined modification or creation time.
     */
    long UNDEFINED_TIME = -1;
}
