/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Duration } from "#general";
import type { Advertiser } from "./Advertiser.js";
import { ServiceDescription } from "./ServiceDescription.js";
/**
 * An advertisement for a discrete service.
 */
export declare abstract class Advertisement<T extends ServiceDescription = ServiceDescription> {
    #private;
    /**
     * The service advertised.
     *
     * This is a unique ID associated with the advertisement.
     */
    readonly service: string;
    /**
     * The information advertised.
     */
    readonly description: T;
    /**
     * The {@link Advertiser} that owns this advertisement.
     */
    readonly advertiser: Advertiser;
    /**
     * Configuration options.
     */
    readonly options: Advertisement.Options;
    constructor(advertiser: Advertiser, service: string, description: T, options?: Advertisement.Options);
    /**
     * Begin automatic broadcast.
     */
    start(event: Advertiser.BroadcastEvent): void;
    /**
     * End automatic broadcast.
     */
    stop(): void;
    /**
     * Notify the advertiser that a client connection to the advertised service is established.
     */
    serviceConnected(): void;
    /**
     * Notify the advertiser that there is no client connection to the advertised service.
     */
    serviceDisconnected(): void;
    /**
     * Close the advertisement but do not wait for the close to finish.
     *
     * The advertisement is still tracked by the advertiser until closed.
     */
    cancel(): void;
    /**
     * Close the advertisement.
     */
    close(): Promise<void>;
    /**
     * Async setup logic.
     */
    protected onCreate(): Promise<void>;
    /**
     * Async cleanup logic.
     */
    protected onClose(): Promise<void>;
    /**
     * Indicates that broadcasts should omit private details.
     */
    protected get isPrivacyMasked(): boolean;
    /**
     * Implement automatic advertising.
     */
    protected abstract run(context: Advertisement.ActivityContext, event: Advertiser.BroadcastEvent): Promise<void>;
    isCommissioning(): this is Advertisement<ServiceDescription.Commissionable> | Advertisement<ServiceDescription.Commissioner>;
    isOperational(): this is Advertisement<ServiceDescription.Operational>;
    /**
     * Cancel a set of advertisements.
     */
    static cancelAll(ads: Iterable<Advertisement>): void;
    /**
     * Cancel a set of advertisements and wait for them to complete.
     */
    static closeAll(ads: Iterable<Advertisement>): Promise<void>;
    /**
     * Identify other advertisers for the same service.  The advertiser will close these automatically.
     */
    abstract isDuplicate(other: Advertisement): boolean;
    /**
     * Total duration so far.
     */
    get duration(): Duration;
    /**
     * True if the advertisement is actively broadcasting.
     */
    get isBroadcasting(): boolean;
    protected dict(values?: Record<string, unknown>): Record<string, unknown>;
}
export declare namespace Advertisement {
    interface Options {
        /**
         * Set this to omit optional details from broadcasts that may affect privacy.
         *
         * Per core spec 5.4.2.3.1, the device always omits vendor ID, product ID and extended data during extended
         * announcement.  Set this value to omit this fields unconditionally.
         */
        omitPrivateDetails?: boolean;
    }
    interface ActivityContext {
        /**
         * Enter cancelable sleep.
         *
         * Throws {@link CanceledError} if interrupted.  If thrown from {@link run} this will result in the promise
         * resolving.
         */
        sleep(name: string, duration: Duration): Promise<void>;
        /** True if the activity has been canceled. */
        cancelled: boolean;
    }
}
//# sourceMappingURL=Advertisement.d.ts.map