import type { GetDeviceConfig } from "@zwave-js/config";
import { CommandClasses, type ControlsCC, type Duration, type EndpointId, type GetEndpoint, type GetNode, type GetSafeCCVersion, type GetSupportedCCVersion, type GetValueDB, type HostIDs, type ListenBehavior, type LogNode, type MaybeNotKnown, NODE_ID_BROADCAST, NODE_ID_BROADCAST_LR, type NodeId, type PhysicalNodes, type QueryNodeInterviewStage, type QueryNodeStatus, type SecurityManagers, type SendCommandOptions, type SupervisionResult, type SupportsCC, type TXReport, type ValueChangeOptions, type ValueDB, type ValueID, type VirtualEndpointId } from "@zwave-js/core";
import { type AllOrNone, type OnlyMethods } from "@zwave-js/shared";
import type { SendCommand } from "./traits.js";
import type { GetRefreshValueTimeouts, GetUserPreferences, SchedulePoll } from "./traits.js";
import type { CCAPIs, CCNameMap } from "./_CCAPI.generated.js";
export type { CCAPIs, CCNameMap };
export type ValueIDProperties = Pick<ValueID, "property" | "propertyKey">;
/** Used to identify the method on the CC API class that handles setting values on nodes directly */
export declare const SET_VALUE: unique symbol;
export type SetValueImplementation = (property: ValueIDProperties, value: unknown, options?: SetValueAPIOptions) => Promise<SupervisionResult | undefined>;
export declare const SET_VALUE_HOOKS: unique symbol;
export type SetValueImplementationHooks = AllOrNone<{
    supervisionDelayedUpdates: boolean;
    supervisionOnSuccess: () => void | Promise<void>;
    supervisionOnFailure: () => void | Promise<void>;
}> & {
    isSplitStateTargetValue?: boolean;
    optimisticallyUpdateRelatedValues?: (supervisedAndSuccessful: boolean) => void;
    forceVerifyChanges?: () => boolean;
    verifyChanges?: (result?: SupervisionResult) => void | Promise<void>;
};
export type SetValueImplementationHooksFactory = (property: ValueIDProperties, value: unknown, options?: SetValueAPIOptions) => SetValueImplementationHooks | undefined;
/**
 * A generic options bag for the `setValue` API.
 * Each implementation will choose the options that are relevant for it, so you can use the same options everywhere.
 * @publicAPI
 */
export type SetValueAPIOptions = Partial<ValueChangeOptions> & Pick<SendCommandOptions, "onProgress">;
/** Used to identify the method on the CC API class that handles polling values from nodes */
export declare const POLL_VALUE: unique symbol;
export type PollValueImplementation<T = unknown> = (property: ValueIDProperties) => Promise<T | undefined>;
export declare function throwUnsupportedProperty(cc: CommandClasses, property: string | number): never;
export declare function throwUnsupportedPropertyKey(cc: CommandClasses, property: string | number, propertyKey: string | number): never;
export declare function throwMissingPropertyKey(cc: CommandClasses, property: string | number): never;
export declare function throwWrongValueType(cc: CommandClasses, property: string | number, expectedType: string, receivedType: string): never;
export interface CCAPISchedulePollOptions {
    duration?: Duration;
    transition?: "fast" | "slow";
}
export type CCAPIHost<TNode extends CCAPINode = CCAPINode> = HostIDs & GetNode<TNode> & GetValueDB & GetSupportedCCVersion & GetSafeCCVersion & SecurityManagers & GetDeviceConfig & SendCommand & GetRefreshValueTimeouts & GetUserPreferences & SchedulePoll & LogNode;
export type CCAPINode = NodeId & ListenBehavior & QueryNodeStatus & QueryNodeInterviewStage;
export type CCAPIEndpoint = ((EndpointId & ControlsCC) | (VirtualEndpointId & {
    node: PhysicalNodes<NodeId & SupportsCC & ControlsCC & GetEndpoint<EndpointId & SupportsCC & ControlsCC>>;
})) & SupportsCC;
export type PhysicalCCAPIEndpoint = CCAPIEndpoint & EndpointId;
export type VirtualCCAPIEndpoint = CCAPIEndpoint & VirtualEndpointId;
/**
 * The base class for all CC APIs exposed via `Node.commandClasses.<CCName>`
 * @publicAPI
 */
export declare class CCAPI {
    protected readonly host: CCAPIHost;
    protected readonly endpoint: CCAPIEndpoint;
    constructor(host: CCAPIHost, endpoint: CCAPIEndpoint);
    static create<T extends CommandClasses>(ccId: T, host: CCAPIHost, endpoint: CCAPIEndpoint, requireSupport?: boolean): CommandClasses extends T ? CCAPI : CCToAPI<T>;
    /**
     * The identifier of the Command Class this API is for
     */
    readonly ccId: CommandClasses;
    protected get [SET_VALUE](): SetValueImplementation | undefined;
    /**
     * Can be used on supported CC APIs to set a CC value by property name (and optionally the property key).
     * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!
     */
    get setValue(): SetValueImplementation | undefined;
    protected [SET_VALUE_HOOKS]: SetValueImplementationHooksFactory | undefined;
    /**
     * Can be implemented by CC APIs to influence the behavior of the setValue API in regards to Supervision and verifying values.
     */
    get setValueHooks(): SetValueImplementationHooksFactory | undefined;
    /** Whether a successful setValue call should imply that the value was successfully updated */
    isSetValueOptimistic(valueId: ValueID): boolean;
    protected get [POLL_VALUE](): PollValueImplementation | undefined;
    /**
     * Can be used on supported CC APIs to poll a CC value by property name (and optionally the property key)
     * **WARNING:** This function is NOT bound to an API instance. It must be called with the correct `this` context!
     */
    get pollValue(): PollValueImplementation | undefined;
    /**
     * Schedules a value to be polled after a given time. Schedules are deduplicated on a per-property basis.
     * @returns `true` if the poll was scheduled, `false` otherwise
     */
    protected schedulePoll({ property, propertyKey }: ValueIDProperties, expectedValue: unknown, { duration, transition }?: CCAPISchedulePollOptions): boolean;
    /**
     * Retrieves the version of the given CommandClass this endpoint implements
     */
    get version(): number;
    /** Determines if this simplified API instance may be used. */
    isSupported(): boolean;
    /**
     * Determine whether the linked node supports a specific command of this command class.
     * {@link NOT_KNOWN} (`undefined`) means that the information has not been received yet
     */
    supportsCommand(command: number): MaybeNotKnown<boolean>;
    protected assertSupportsCommand(commandEnum: unknown, command: number): void;
    protected assertPhysicalEndpoint(endpoint: EndpointId | VirtualEndpointId): asserts endpoint is EndpointId;
    /** Returns the command options to use for sendCommand calls */
    protected get commandOptions(): SendCommandOptions;
    /** Creates an instance of this API, scoped to use the given options */
    withOptions(options: SendCommandOptions): this;
    /** Creates an instance of this API which (if supported) will return TX reports along with the result. */
    withTXReport<T extends this>(): WithTXReport<T>;
    protected isSinglecast(): this is this & {
        endpoint: PhysicalCCAPIEndpoint;
    };
    protected isMulticast(): this is this & {
        endpoint: VirtualCCAPIEndpoint & {
            nodeId: number[];
        };
    };
    protected isBroadcast(): this is this & {
        endpoint: VirtualCCAPIEndpoint & {
            nodeId: typeof NODE_ID_BROADCAST | typeof NODE_ID_BROADCAST_LR;
        };
    };
    /** Returns the value DB for this CC API's node (if it can be safely accessed) */
    protected tryGetValueDB(): ValueDB | undefined;
    /** Returns the value DB for this CC's node (or throws if it cannot be accessed) */
    protected getValueDB(): ValueDB;
}
/** A CC API that is only available for physical endpoints */
export declare class PhysicalCCAPI extends CCAPI {
    constructor(host: CCAPIHost, endpoint: CCAPIEndpoint);
    protected readonly endpoint: PhysicalCCAPIEndpoint;
}
export type APIConstructor<T extends CCAPI = CCAPI> = new (host: CCAPIHost, endpoint: CCAPIEndpoint) => T;
export type CCToName<CC extends CommandClasses> = {
    [K in keyof CCNameMap]: CCNameMap[K] extends CC ? K : never;
}[keyof CCNameMap];
export type CCNameOrId = CommandClasses | Extract<keyof CCAPIs, string>;
export type CCToAPI<CC extends CCNameOrId> = CC extends CommandClasses ? CCToName<CC> extends keyof CCAPIs ? CCAPIs[CCToName<CC>] : never : CC extends keyof CCAPIs ? CCAPIs[CC] : never;
export type APIMethodsOf<CC extends CCNameOrId> = Omit<OnlyMethods<CCToAPI<CC>>, "ccId" | "getNode" | "tryGetNode" | "isSetValueOptimistic" | "isSupported" | "pollValue" | "setValue" | "version" | "supportsCommand" | "withOptions" | "withTXReport">;
export type OwnMethodsOf<API extends CCAPI> = Omit<OnlyMethods<API>, keyof OnlyMethods<CCAPI>>;
export type WrapWithTXReport<T> = [T] extends [Promise<infer U>] ? Promise<WrapWithTXReport<U>> : [T] extends [void] ? {
    txReport: TXReport | undefined;
} : {
    result: T;
    txReport: TXReport | undefined;
};
export type ReturnWithTXReport<T> = T extends (...args: any[]) => any ? (...args: Parameters<T>) => WrapWithTXReport<ReturnType<T>> : undefined;
export type WithTXReport<API extends CCAPI> = Omit<API, keyof OwnMethodsOf<API> | "withOptions" | "withTXReport" | "setValue"> & {
    [K in keyof OwnMethodsOf<API> | "setValue" | "pollValue"]: ReturnWithTXReport<API[K]>;
};
export declare function normalizeCCNameOrId(ccNameOrId: number | string): CommandClasses | undefined;
//# sourceMappingURL=API.d.ts.map