/// <summary>
 /// Initializes a new instance of the <see cref="GetContentTypeProperty"/> class.
 /// </summary>
 /// <param name="entry">The entry to instantiate this property for</param>
 /// <param name="store">The property store to store this property</param>
 /// <param name="mimeTypeDetector">The mime type detector</param>
 /// <param name="cost">The cost of querying the display names property</param>
 public GetContentTypeProperty([NotNull] IEntry entry, [NotNull] IPropertyStore store, [CanBeNull] IMimeTypeDetector mimeTypeDetector = null, int?cost = null)
     : base(PropertyName, null, cost ?? store.Cost, null, null, WebDavXml.Dav + "contenttype")
 {
     _mimeTypeDetector = mimeTypeDetector;
     _entry            = entry;
     _store            = store;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="WebDavDispatcherClass1"/> class.
        /// </summary>
        /// <param name="class1Handlers">The WebDAV class 1 handlers</param>
        /// <param name="context">The WebDAV context</param>
        /// <param name="deadPropertyFactory">The factory to create dead properties</param>
        /// <param name="mimeTypeDetector">The mime type detector for the getmimetype property</param>
        /// <param name="options">The options for the WebDAV class 1 implementation</param>
        public WebDavDispatcherClass1(
            IEnumerable <IClass1Handler> class1Handlers,
            IWebDavContext context,
            IDeadPropertyFactory deadPropertyFactory,
            IMimeTypeDetector mimeTypeDetector,
            IOptions <WebDavDispatcherClass1Options> options)
        {
            _deadPropertyFactory = deadPropertyFactory;
            _mimeTypeDetector    = mimeTypeDetector;
            var httpMethods = new HashSet <string>();

            foreach (var class1Handler in class1Handlers)
            {
                var handlerFound = false;

                if (class1Handler is IOptionsHandler optionsHandler)
                {
                    _optionsHandler = optionsHandler;
                    handlerFound    = true;
                }

                if (class1Handler is IPropFindHandler propFindHandler)
                {
                    _propFindHandler = propFindHandler;
                    handlerFound     = true;
                }

                if (class1Handler is IGetHandler getHandler)
                {
                    _getHandler  = getHandler;
                    handlerFound = true;
                }

                if (class1Handler is IHeadHandler headHandler)
                {
                    _headHandler = headHandler;
                    handlerFound = true;
                }

                if (class1Handler is IPropPatchHandler propPatchHandler)
                {
                    _propPatchHandler = propPatchHandler;
                    handlerFound      = true;
                }

                if (class1Handler is IPutHandler putHandler)
                {
                    _putHandler  = putHandler;
                    handlerFound = true;
                }

                if (class1Handler is IMkColHandler mkColHandler)
                {
                    _mkColHandler = mkColHandler;
                    handlerFound  = true;
                }

                if (class1Handler is IDeleteHandler deleteHandler)
                {
                    _deleteHandler = deleteHandler;
                    handlerFound   = true;
                }

                if (class1Handler is ICopyHandler copyHandler)
                {
                    _copyHandler = copyHandler;
                    handlerFound = true;
                }

                if (class1Handler is IMoveHandler moveHandler)
                {
                    _moveHandler = moveHandler;
                    handlerFound = true;
                }

                if (!handlerFound)
                {
                    throw new NotSupportedException();
                }

                foreach (var httpMethod in class1Handler.HttpMethods)
                {
                    httpMethods.Add(httpMethod);
                }
            }

            HttpMethods   = httpMethods.ToList();
            WebDavContext = context;

            OptionsResponseHeaders = new Dictionary <string, IEnumerable <string> >()
            {
                ["Allow"] = HttpMethods,
            };

            DefaultResponseHeaders = new Dictionary <string, IEnumerable <string> >()
            {
                ["DAV"] = new[] { "1" },
            };

            _defaultCreationMap = new Lazy <IReadOnlyDictionary <XName, CreateDeadPropertyDelegate> >(() => CreateDeadPropertiesMap(options?.Value ?? new WebDavDispatcherClass1Options()));
        }