import Foundation

/// XPC contract shared by the GUI and its root power helper. A connection owns one lease; launchd
/// tears the connection down when the GUI exits, which lets the helper restore normal lid sleep.
@objc public protocol NucleicPowerHelperProtocol {
    func setFullWakeActive(
        _ active: Bool, withReply reply: @escaping @Sendable (NSError?) -> Void)
}

public enum NucleicPowerHelperConstants {
    public static let executableName = "nucleic-power-helper"
    public static let plistName = serviceName + ".plist"

    public static let serviceName: String = {
        #if NUCLEIC_STABLE
        "xyz.blakeslee.nucleic.power-helper.release"
        #elseif NUCLEIC_RC
        "xyz.blakeslee.nucleic.power-helper.rc"
        #elseif NUCLEIC_BETA
        "xyz.blakeslee.nucleic.power-helper.beta"
        #elseif NUCLEIC_CANARY
        "xyz.blakeslee.nucleic.power-helper.canary"
        #else
        "xyz.blakeslee.nucleic.power-helper.dev"
        #endif
    }()

    public static let appBundleIdentifier: String = {
        #if NUCLEIC_STABLE
        "xyz.blakeslee.nucleic.desktop.release"
        #elseif NUCLEIC_RC
        "xyz.blakeslee.nucleic.desktop.rc"
        #elseif NUCLEIC_BETA
        "xyz.blakeslee.nucleic.desktop.beta"
        #elseif NUCLEIC_CANARY
        "xyz.blakeslee.nucleic.desktop.canary"
        #else
        "xyz.blakeslee.nucleic.desktop.dev"
        #endif
    }()
}
