/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Diagnostic } from "#log/Diagnostic.js";
import { Duration } from "#time/Duration.js";
import { Timestamp } from "#time/Timestamp.js";
export interface AddressLifespan {
    /**
     * Beginning of lifespan
     */
    discoveredAt: Timestamp;
    /**
     * Length of lifespan, if known
     */
    ttl: Duration;
}
export interface AddressStatus extends Partial<AddressLifespan> {
    /**
     * Time of last successful access.
     */
    healthyAt?: Timestamp;
    /**
     * Time of last unsuccessful access.
     */
    unhealthyAt?: Timestamp;
    /**
     * DNS priority.
     */
    priority?: number;
    /**
     * DNS weight.
     */
    weight?: number;
}
/** Transport-agnostic IP address as discovered via DNS-SD. */
export type ServerAddressIp = {
    ip: string;
    port: number;
} & AddressStatus;
/** IP address with explicit UDP transport. */
export type ServerAddressUdp = ServerAddressIp & {
    type: "udp";
};
/** IP address with explicit TCP transport. */
export type ServerAddressTcp = ServerAddressIp & {
    type: "tcp";
};
export type ServerAddressBle = {
    type: "ble";
    peripheralAddress: string;
} & AddressStatus;
export type ServerAddress = ServerAddressIp | ServerAddressUdp | ServerAddressTcp | ServerAddressBle;
export declare function ServerAddress(definition: ServerAddress): ServerAddress;
export declare namespace ServerAddress {
    /** Type guard for IP-based addresses (with or without explicit transport type). */
    function isIp(address: ServerAddress): address is ServerAddressIp;
    /** Type guard for BLE addresses. */
    function isBle(address: ServerAddress): address is ServerAddressBle;
    /** Returns the transport protocol label for display — "udp", "tcp", or "ip" if unspecified. */
    function protocolOf(address: ServerAddress): string;
    function urlFor(address: ServerAddress): string;
    function diagnosticFor(address: ServerAddress): Diagnostic;
    /** IP addresses are equal if ip and port match, regardless of transport type. */
    function isEqual(a: ServerAddress, b: ServerAddress): boolean;
    /**
     * Compute logical health of an address.
     *
     * This returns heathyAt/unhealthyAt values with unhealthyAt set to undefined if the address was more recently
     * healthy.
     */
    function healthOf(health: AddressStatus): AddressStatus;
    /**
     * Network address desirability from a Matter communication perspective.
     *
     * Lower values indicate higher preference.  This is not a standard "happy eyeballs" ranking: link-local is most
     * likely reachable (same link, immune to prefix changes), and ULA ranks above global because Matter ULAs are
     * typically Thread mesh addresses routed via the border router while globals may rotate.
     */
    enum SelectionPreference {
        IPV6_LINK_LOCAL = 0,
        IPV6_ULA = 1,
        IPV6 = 2,
        IPV4 = 3,
        NOT_IP = 3
    }
    function isIpv6LinkLocal(ip: string): boolean;
    function selectionPreferenceOf(address: ServerAddress): SelectionPreference;
    function selectionPreferenceOfIp(ip: string): SelectionPreference;
}
//# sourceMappingURL=ServerAddress.d.ts.map