import type { Writer, Reader } from './index.ts';
export declare const CODEC_TYPES: {
    VARINT: number;
    BIT64: number;
    LENGTH_DELIMITED: number;
    START_GROUP: number;
    END_GROUP: number;
    BIT32: number;
};
export interface EncodeOptions {
    lengthDelimited?: boolean;
    writeDefaults?: boolean;
}
export interface EncodeFunction<T> {
    (value: Partial<T>, writer: Writer, opts?: EncodeOptions): void;
}
type CollectionTypes = any[] | Map<any, any>;
type PrimitiveTypes = boolean | number | string | bigint | Uint8Array;
type CollectionLimits<T> = {
    [K in keyof T]: T[K] extends CollectionTypes ? number : T[K] extends PrimitiveTypes ? never : Limits<T[K]>;
};
type ArrayElementLimits<T> = {
    [K in keyof T as `${string & K}$`]: T[K] extends Array<infer ElementType> ? (ElementType extends PrimitiveTypes ? never : Limits<ElementType>) : (T[K] extends PrimitiveTypes ? never : Limits<T[K]>);
};
type MapValueLimits<T> = {
    [K in keyof T as `${string & K}$value`]: T[K] extends Map<any, infer MapValueType> ? (MapValueType extends PrimitiveTypes ? never : Limits<MapValueType>) : (T[K] extends PrimitiveTypes ? never : Limits<T[K]>);
};
type Limits<T> = Partial<CollectionLimits<T> & ArrayElementLimits<T> & MapValueLimits<T>>;
export interface DecodeOptions<T> {
    /**
     * Runtime-specified limits for lengths of repeated/map fields
     */
    limits?: Limits<T>;
}
export interface DecodeFunction<T> {
    (reader: Reader, length?: number, opts?: DecodeOptions<T>): T;
}
export interface StreamFunction<T> {
    (reader: Reader, length?: number, prefix?: string, opts?: DecodeOptions<T>): Generator<any>;
}
export interface Codec<T> {
    name: string;
    type: number;
    encode: EncodeFunction<T>;
    decode: DecodeFunction<T>;
    stream: StreamFunction<T>;
}
export declare function createCodec<T>(name: string, type: number, encode: EncodeFunction<T>, decode: DecodeFunction<T>, stream: StreamFunction<T>): Codec<T>;
export {};
//# sourceMappingURL=codec.d.ts.map