import type { NobjcObject } from "objc-js";
import type { _NSError } from "../Foundation/NSError.js";
import type { _NSObject } from "../Foundation/NSObject.js";
import type { _NSString } from "../Foundation/NSString.js";
import type { _NSURL } from "../Foundation/NSURL.js";
import type { SMAppServiceStatus } from "./SMAppServiceStatus.js";
export declare class _SMAppService extends _NSObject {
    static alloc(): _SMAppService;
    static new(): _SMAppService;
    init(): _SMAppService;
    /**
     * Initializes a SMAppService for a LoginItem corresponding to the bundle with the specified identifier. The bundle identifier of the helper application The identifier must correspond to the bundle identifier for a LoginItem that lives in the calling app's Contents/Library/LoginItems directory
     */
    static loginItemServiceWithIdentifier$(identifier: _NSString): _SMAppService;
    /**
     * Initializes a SMAppService with a LaunchAgent with the specified plist name. The name of the plist corresponding to the SMAppService. The plistName must correspond to a plist in the calling app's Contents/Library/LaunchAgents directory In addition to the standard launchd.plist keys, plists registered with SMAppService may use the BundleProgram launchd plist key to specify an app bundle relative path for the executable. This key allows apps to support a user relocating the app bundle after installation.
     */
    static agentServiceWithPlistName$(plistName: _NSString): _SMAppService;
    /**
     * Initializes a SMAppService with a LaunchDaemon with the specified plist name. The name of the plist corresponding to the SMAppService. The plistName must correspond to a plist in the calling app's Contents/Library/LaunchDaemons directory In addition to the standard launchd.plist keys, plists registered with SMAppService may use the BundleProgram launchd plist key to specify an app bundle relative path for the executable. This key allows apps to support a user relocating the app bundle after installation. For a LaunchDaemon to be bootstrapped during boot, the containing application must be accessible before a user logs in. For applications that intend to register LaunchDaemons, it is recommended that the application bundle live in /Applications
     */
    static daemonServiceWithPlistName$(plistName: _NSString): _SMAppService;
    /**
     * Returns the status for a legacy service A URL pointing to a legacy service plist Valid URLs have the prefix /Library/LaunchDaemons /Library/LaunchAgents or /Users/$USER/Library/LaunchAgents This API is intended for apps that are unable to adopt the new daemon and agent packaging guidelines but still want to know when a user disables its legacy daemons or agents. As a best practice, apps can check the status of their helpers when they are launched and should also check the status of their helpers when handling XPC connection errors to help determine if the cause of the error is because a user disabled a helper.
     */
    static statusForLegacyURL$(url: _NSURL): SMAppServiceStatus;
    /**
     * Opens System Settings to the Login Items panel This API is intended for apps to call whenever they present a prompt to the user and the user confirms that they want to enable the app's helpers again. The app can call this API to help the user navigate to the appropriate panel in System Settings.
     */
    static openSystemSettingsLoginItems(): void;
    /**
     * A SMAppService corresponding to the main application as a LoginItem This SMAppService can be used to configure the main app to be launched at login
     */
    static mainAppService(): _SMAppService;
    /**
     * Registers the service such that it may begin launching subject to user consent Upon unsuccessful return, a new NSError object describing the error. Upon successful return, this argument is set to NULL. This argument may be NULL. YES if the service was successfully registered, otherwise NO. If the service corresponds to a LoginItem bundle, the helper will be started immediately and on subsequent logins. If the helper crashes or exits non-zero it will be relaunched. If the service corresponds to the main application, the application will be launched on subsequent logins. If the service corresponds to a LaunchAgent, the LaunchAgent is immediately bootstrapped and may begin running. In addition LaunchAgents registered with this API will be bootstrapped on each subsequent login. If an app desires to register a LaunchAgent for multiple users, the API must be called once per user while the desired user is running the app. LaunchAgents cannot be registered from outside a user context using this API. If the service corresponds to a LaunchDaemon, the LaunchDaemon will not be bootstrapped until an admin approves the LaunchDaemon in System Settings. LaunchDaemons registered with this API and approved by an admin will be bootstrapped on each subsequent boot. If the service is already registered, this API will return error kSMErrorAlreadyRegistered If the service is not approved by the user, this API will return error kSMErrorLaunchDeniedByUser If the app bundle is not properly code signed, this API will return error kSMErrorInvalidSignature SMAppService:unregisterAndReturnError
     */
    registerAndReturnError$(error: NobjcObject | null): boolean;
    /**
     * Unregisters the service such that it will no longer be launched by the system. Upon unsuccessful return, a new NSError object describing the error. Upon successful return, this argument is set to NULL. This argument may be NULL. YES if the service was successfully unregistered, otherwise NO. If the service corresponds to a LoginItem, LaunchAgent, or LaunchDaemon and the service is currently running it will be killed. The unregister call will not wait for the service to be reaped. If the service corresponds to the main application, it will continue running, but will still be unregistered to prevent future launches at login. This is the opposite operation of SMAppService:register If the service is already unregistered, this API will return error kSMErrorJobNotFound SMAppService:registerAndReturnError
     */
    unregisterAndReturnError$(error: NobjcObject | null): boolean;
    /**
     * Unregisters the service such that it will no longer be launched by the system. The completion handler block to be invoked with the result of the unregister operation. This handler will be invoked on libdispatch's default target queue If the service corresponds to a LoginItem, LaunchAgent, or LaunchDaemon and the service is currently running it will be killed. The unregister call will not wait for the service to be killed and will return promptly. The completion handler will be invoked after the running process has been killed if successful or will be invoked whenever an error occurs. After the completion handler has been invoked it is safe to re-register the service. If the service corresponds to the main application, it will continue running, but will still be unregistered to prevent future launches at login. This is the opposite operation of SMAppService:register This is the asynchronous variant of SMAppService:unregisterAndReturnError If the service is already unregistered, this API will return error kSMErrorJobNotFound SMAppService:unregisterAndReturnError
     */
    unregisterWithCompletionHandler$(handler: ((error: _NSError) => void) | null): void;
    /**
     * Returns the status for the service The status API can be used to check what selection a user has made regarding allowing the service to launch. If the user has denied execution, the return value will be SMAppServiceRequiresApproval. If the service has been unregistered, the return value will be SMAppServiceNotRegistered
     */
    status(): SMAppServiceStatus;
}
