#pragma once

#include <string>
#include <memory>

namespace celuna {

/**
 * @brief Interface for window tracking across platforms
 *
 * Implementations:
 * - Win32WindowTracker: Windows (GetForegroundWindow)
 * - X11WindowTracker: Linux with X11
 * - StubWindowTracker: Fallback for unsupported platforms
 */
class IWindowTracker {
public:
    virtual ~IWindowTracker() = default;

    /**
     * @brief Get the name of the currently focused application
     * @return Application/process name (e.g., "Code", "firefox")
     */
    virtual std::string getCurrentAppName() = 0;

    /**
     * @brief Get the title of the currently focused window
     * @return Window title string
     */
    virtual std::string getCurrentWindowTitle() = 0;

    /**
     * @brief Check if user has been idle (no input) for given threshold
     * @param thresholdSeconds Seconds of inactivity to consider idle
     * @return true if user is idle
     */
    virtual bool isUserIdle(int thresholdSeconds) = 0;

    /**
     * @brief Get idle time in seconds
     * @return Seconds since last user input
     */
    virtual int getIdleTimeSeconds() = 0;

    /**
     * @brief Check if this tracker is functional on current platform
     * @return true if tracking is available
     */
    virtual bool isAvailable() const = 0;

    /**
     * @brief Get platform name
     * @return Platform identifier (e.g., "win32", "x11", "stub")
     */
    virtual std::string getPlatformName() const = 0;
};

/**
 * @brief Factory to create appropriate tracker for current platform
 */
class WindowTrackerFactory {
public:
    static std::unique_ptr<IWindowTracker> create();
};

} // namespace celuna
