/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import type { ExchangeLogContext } from "#protocol/MessageExchange.js";
import { Bytes } from "@matter/general";
import { NodeId } from "@matter/types";
export interface PacketHeader {
    sessionId: number;
    sessionType: SessionType;
    hasPrivacyEnhancements: boolean;
    isControlMessage: boolean;
    hasMessageExtensions: boolean;
    messageId: number;
    sourceNodeId?: NodeId;
    destNodeId?: NodeId;
    destGroupId?: number;
}
export interface DecodedPacketHeader extends PacketHeader {
    securityFlags: number;
}
export interface PayloadHeader {
    exchangeId: number;
    protocolId: number;
    messageType: number;
    isInitiatorMessage: boolean;
    requiresAck: boolean;
    ackedMessageId?: number;
    hasSecuredExtension: boolean;
}
export interface Packet {
    header: PacketHeader;
    messageExtension?: Bytes;
    applicationPayload: Bytes;
}
export interface DecodedPacket extends Packet {
    header: DecodedPacketHeader;
}
export interface Message {
    packetHeader: PacketHeader;
    payloadHeader: PayloadHeader;
    securityExtension?: Bytes;
    payload: Bytes;
}
export declare namespace Message {
    function via({ via }: {
        via: string;
    }, { packetHeader: { messageId } }: Message): string;
    function diagnosticsOf(context: {
        via: string;
    }, message: Message, logContext?: ExchangeLogContext): Record<string, unknown>;
}
export interface DecodedMessage extends Message {
    packetHeader: DecodedPacketHeader;
}
export declare enum SessionType {
    Group = 1,
    Unicast = 0
}
export declare class MessageCodec {
    static decodePacket(data: Bytes): DecodedPacket;
    static decodePayload({ header, applicationPayload }: DecodedPacket): DecodedMessage;
    static encodePayload({ packetHeader, payloadHeader, payload, securityExtension }: Message): Packet;
    static encodePacket({ header, applicationPayload, messageExtension }: Packet): Bytes;
    private static decodePacketHeader;
    private static decodePayloadHeader;
    static encodePacketHeader({ messageId: messageCounter, sessionId, destGroupId, destNodeId, sourceNodeId, sessionType, }: PacketHeader): Uint8Array<ArrayBufferLike>;
    private static encodePayloadHeader;
}
//# sourceMappingURL=MessageCodec.d.ts.map