/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *     http://aws.amazon.com/apache2.0/
 *
 * or in the "license" file accompanying this file. This file 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.
 */

#ifndef ALEXA_CLIENT_SDK_AVS_SHARED_PRESENTATIONORCHESTRATOR_PRESENTATIONORCHESTRATORINTERFACES_INCLUDE_ACSDK_PRESENTATIONORCHESTRATORINTERFACES_VISUALTIMEOUTMANAGERINTERFACE_H_
#define ALEXA_CLIENT_SDK_AVS_SHARED_PRESENTATIONORCHESTRATOR_PRESENTATIONORCHESTRATORINTERFACES_INCLUDE_ACSDK_PRESENTATIONORCHESTRATORINTERFACES_VISUALTIMEOUTMANAGERINTERFACE_H_

#include <chrono>
#include <functional>

#include <AVSCommon/SDKInterfaces/DialogUXStateObserverInterface.h>
#include <AVSCommon/SDKInterfaces/GUIActivityEventObserverInterface.h>

namespace alexaClientSDK {
namespace presentationOrchestratorInterfaces {

class VisualTimeoutManagerInterface
        : public avsCommon::sdkInterfaces::DialogUXStateObserverInterface
        , public avsCommon::sdkInterfaces::GUIActivityEventObserverInterface {
public:
    virtual ~VisualTimeoutManagerInterface() = default;

    using VisualTimeoutCallback = std::function<void()>;
    using VisualTimeoutId = unsigned int;

    /**
     * Creates a timeout, replaces any existing timeout which was registered
     * @param delay The time which must elapse before the timeout is fired
     * @param timeoutCallback The callback which will be fired upon the timeout expiring
     * @return An identifier uniquely identifying this timeout
     */
    virtual VisualTimeoutId requestTimeout(std::chrono::milliseconds delay, VisualTimeoutCallback timeoutCallback) = 0;

    /**
     * Stops a running timeout
     * @param timeoutId The identifier returned in the call to requestTimeout
     * @return true if the timeout was stopped, false if this timeoutId does not match the id generated by the last call
     * to requestTimeout
     */
    virtual bool stopTimeout(VisualTimeoutId timeoutId) = 0;
};
}  // namespace presentationOrchestratorInterfaces
}  // namespace alexaClientSDK

#endif  // ALEXA_CLIENT_SDK_AVS_SHARED_PRESENTATIONORCHESTRATOR_PRESENTATIONORCHESTRATORINTERFACES_INCLUDE_ACSDK_PRESENTATIONORCHESTRATORINTERFACES_VISUALTIMEOUTMANAGERINTERFACE_H_
