#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
# Copyright 2012 Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


from __future__ import with_statement

raise ImportError("Not implemented yet.")

from watchdog.utils import platform

if platform.is_windows():
    import threading

    from watchdog.observers.api import (
        EventEmitter,
        BaseObserver,
        DEFAULT_OBSERVER_TIMEOUT,
        DEFAULT_EMITTER_TIMEOUT
    )

    class WindowsApiAsyncEmitter(EventEmitter):

        """
        Platform-independent emitter that polls a directory to detect file
        system changes.
        """

        def __init__(self, event_queue, watch, timeout=DEFAULT_EMITTER_TIMEOUT):
            EventEmitter.__init__(self, event_queue, watch, timeout)
            self._lock = threading.Lock()

        def queue_events(self, timeout):
            with self._lock:
                pass

    class WindowsApiAsyncObserver(BaseObserver):

        """
        Observer thread that schedules watching directories and dispatches
        calls to event handlers.
        """

        def __init__(self, timeout=DEFAULT_OBSERVER_TIMEOUT):
            BaseObserver.__init__(self, emitter_class=WindowsApiAsyncEmitter,
                                  timeout=timeout)
