/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { DnsRecord, DnsRecordType, SrvRecordValue } from "#codec/DnsCodec.js";
import type { Timestamp } from "#time/Timestamp.js";
import { Bytes } from "#util/Bytes.js";
import { AsyncObserver, BasicObservable } from "#util/Observable.js";
import { MaybePromise } from "#util/Promises.js";
import { DnssdParameters } from "./DnssdParameters.js";
/**
 * Grace factor applied to record TTLs so timing jitter doesn't cause premature expiry and spurious re-queries.
 */
export declare const DEFAULT_TTL_GRACE_FACTOR = 1.05;
/**
 * Manages records associated with a single DNS-SD qname.
 *
 * Every DNS-SD qname of interest has a 1:1 relationship with a single instance of this class in the context of a
 * {@link DnssdNames}.  We therefore can use the qname or {@link DnssdName} interchangeably.
 *
 * An {@link DnssdName} is created when a new name is discovered or requested by another component.  The name
 * automatically deletes when there are no longer observers or unexpired records.
 */
export declare class DnssdName extends BasicObservable<[changes: DnssdName.Changes], MaybePromise> {
    #private;
    readonly qname: string;
    constructor(qname: string, context: DnssdName.Context);
    off(observer: AsyncObserver<[]>): void;
    close(): Promise<void>;
    get records(): MapIterator<DnssdName.Record>;
    get parameters(): DnssdParameters;
    get isDiscovered(): boolean;
    installRecord(record: DnsRecord<any>, options?: DnssdName.InstallOptions): false | undefined;
    deleteRecord(record: DnsRecord, ifOlderThan?: Timestamp): void;
}
export declare namespace DnssdName {
    interface Context {
        delete(name: DnssdName): void;
        registerForExpiration(record: Record): void;
        unregisterForExpiration(record: Record): void;
        get(qname: string): DnssdName;
        /**
         * Multiplier applied to TTL when computing record expiry.  Always provided by {@link DnssdNames}.
         */
        ttlGraceFactor: number;
    }
    interface Expiration {
        installedAt: Timestamp;
        expiresAt: Timestamp;
    }
    interface PointerRecord extends DnsRecord<string>, Expiration {
        recordType: DnsRecordType.PTR;
    }
    interface HostRecord extends DnsRecord<string>, Expiration {
        recordType: DnsRecordType.A | DnsRecordType.AAAA;
        /** Receive interface — populated only for AAAA, needed to form %zone for fe80 addresses. */
        sourceIntf: string | undefined;
    }
    interface InstallOptions {
        /** Explicit install timestamp; defaults to `Time.nowMs`.  Set by the staged-replay path. */
        installedAt?: Timestamp;
        /** Interface on which the record was received.  Honoured only for AAAA records. */
        sourceIntf?: string;
    }
    interface ServiceRecord extends DnsRecord<SrvRecordValue>, Expiration {
        recordType: DnsRecordType.SRV;
    }
    interface TextRecord extends DnsRecord<Bytes[]>, Expiration {
        recordType: DnsRecordType.TXT;
    }
    type Record = PointerRecord | ServiceRecord | HostRecord | TextRecord;
    interface Changes {
        name: DnssdName;
        updated?: Record[];
        deleted?: Record[];
    }
}
//# sourceMappingURL=DnssdName.d.ts.map