// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef POLKIT_AUTH_H
#define POLKIT_AUTH_H

#include <polkit/polkit.h>
#include <stdbool.h>

// PolicyKit action IDs
#define POLKIT_ACTION_EXPORT_LOG "org.deepin.immutable.ReadOnlyAuditor1.export-log"
#define POLKIT_ACTION_SET_ENABLED "org.deepin.immutable.ReadOnlyAuditor1.set-enabled"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Check if the D-Bus caller has permission to perform the specified action
 *
 * Uses PolkitAuthority and PolkitSystemBusName to check authorization.
 * Does not trigger interactive authentication (no dialog popup).
 *
 * @param sender The D-Bus sender bus name (e.g., ":1.234")
 * @param action_id The polkit action ID to check
 * @return true if authorized, false otherwise
 */
bool polkit_check_authorization(const char *sender, const char *action_id);

#ifdef __cplusplus
}
#endif

#endif // POLKIT_AUTH_H
