/*
 * Fooyin
 * Copyright © 2026, Luke Taylor <luket@pm.me>
 * Copyright © 2026, Gustav Oechler <gustavoechler@gmail.com>
 *
 * Fooyin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Fooyin is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Fooyin.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "inhibitor.h"

Q_LOGGING_CATEGORY(SLEEPINHIBITOR, "fy.sleepinhibitor")

#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
#include "platforms/inhibitordbus.h"
namespace Fooyin::SleepInhibitor {
using InhibitorPlatform = InhibitorDbus;
}
#endif

#ifdef Q_OS_WIN
#include "platforms/inhibitorwin32.h"
namespace Fooyin::SleepInhibitor {
using InhibitorPlatform = InhibitorWin32;
}
#endif

#ifdef Q_OS_MAC
#include "platforms/inhibitormacos.h"
namespace Fooyin::SleepInhibitor {
using InhibitorPlatform = InhibitorMacOs;
}
#endif

namespace Fooyin::SleepInhibitor {
InhibitorPrivate::InhibitorPrivate(QObject* parent)
    : QObject{parent}
{ }

Inhibitor::Inhibitor(QObject* parent)
    : QObject{parent}
    , p{new InhibitorPlatform(this)}
{ }

void Inhibitor::inhibitSleep()
{
    p->inhibitSleep();
}

void Inhibitor::uninhibitSleep()
{
    p->uninhibitSleep();
}
} // namespace Fooyin::SleepInhibitor
