/**
 * @license
 * Copyright 2022-2025 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
import { Bytes, DataReader, DataWriter, Endian } from "#general";
/**
 * TLV element types.
 *
 * @see {@link MatterSpecification.v10.Core} § A.7.1
 */
export declare enum TlvType {
    SignedInt = 0,
    UnsignedInt = 4,
    Boolean = 8,
    Float = 10,
    Utf8String = 12,
    ByteString = 16,
    Null = 20,
    Structure = 21,
    Array = 22,
    List = 23,
    EndOfContainer = 24
}
/** Byte length of the encoded value or length. */
export declare enum TlvLength {
    OneByte = 0,
    TwoBytes = 1,
    FourBytes = 2,
    EightBytes = 3
}
/** Type and length or value, when applicable. */
export type TlvTypeLength = {
    type: TlvType.SignedInt;
    length: TlvLength;
} | {
    type: TlvType.UnsignedInt;
    length: TlvLength;
} | {
    type: TlvType.Boolean;
    value: boolean;
} | {
    type: TlvType.Float;
    length: TlvLength.FourBytes | TlvLength.EightBytes;
} | {
    type: TlvType.Utf8String;
    length: TlvLength;
} | {
    type: TlvType.ByteString;
    length: TlvLength;
} | {
    type: TlvType.Null;
} | {
    type: TlvType.Structure;
} | {
    type: TlvType.Array;
} | {
    type: TlvType.List;
} | {
    type: TlvType.EndOfContainer;
};
/** Converts {@link TlvType} to the js primitive type.  */
export type TlvToPrimitive = {
    [TlvType.SignedInt]: bigint | number;
    [TlvType.UnsignedInt]: bigint | number;
    [TlvType.Boolean]: never;
    [TlvType.Float]: number;
    [TlvType.Utf8String]: string;
    [TlvType.ByteString]: Bytes;
    [TlvType.Null]: null;
    [TlvType.Structure]: never;
    [TlvType.Array]: never;
    [TlvType.List]: never;
    [TlvType.EndOfContainer]: never;
};
/** {@link MatterSpecification.v10.Core} § A.2 */
export type TlvTag = {
    profile?: number;
    id?: number;
};
export declare class TlvCodec {
    static getUIntTlvLength(value: number | bigint): TlvLength;
    static getIntTlvLength(value: number | bigint): TlvLength;
    /** @see {@link MatterSpecification.v10.Core} § A.7 */
    static readTagType(reader: DataReader<Endian.Little>): {
        tag?: TlvTag;
        typeLength: TlvTypeLength;
    };
    private static readTag;
    private static parseTypeLength;
    static readPrimitive<T extends TlvTypeLength, V = TlvToPrimitive[T["type"]]>(reader: DataReader<Endian.Little>, typeLength: T): V;
    /** @see {@link MatterSpecification.v10.Core} § A.7 & A.8 */
    static writeTag(writer: DataWriter<Endian.Little>, typeLengthValue: TlvTypeLength, tag?: TlvTag): void;
    static getTagByteLength(tag?: TlvTag): 1 | 2 | 3 | 5 | 7 | 9;
    static writePrimitive<T extends TlvTypeLength>(writer: DataWriter<Endian.Little>, typeLength: T, value: TlvToPrimitive[T["type"]]): void;
    static getPrimitiveByteLength<T extends TlvTypeLength>(typeLength: T, value: TlvToPrimitive[T["type"]]): number;
    private static writeUInt;
    private static getUIntByteLength;
}
//# sourceMappingURL=TlvCodec.d.ts.map