/**
 * A type-safe wrapper around {@link Record} that carries the data type `T`
 * through its entire lifecycle — from write to read, query, update, and
 * subscribe.
 *
 * `TypedRecord<T>` uses composition (not inheritance) to wrap the underlying
 * untyped `Record` class. All read-only getters and lifecycle methods are
 * forwarded, while data-access and mutation methods are enhanced with the
 * generic `T`:
 *
 * - `.data.json()` returns `Promise<T>` instead of `Promise<unknown>`.
 * - `.update({ data })` accepts `Partial<T>` for the data payload.
 *
 * @example
 * ```ts
 * const { record } = await typed.records.write('friend', {
 *   data: { did: 'did:example:alice', alias: 'Alice' },
 * });
 *
 * // record is TypedRecord<FriendData>
 * const data = await record.data.json(); // FriendData — no manual cast
 * ```
 */
import type { Record } from './record.js';
import type { RecordData } from './record-data.js';
import type { DwnDateSort, DwnMessage, DwnPaginationCursor, DwnResponseStatus } from '@enbox/agent';
import type { RecordDeleteParams, RecordModel, RecordUpdateParams } from './record-types.js';
import type { DwnInterface } from '@enbox/agent';
/**
 * A data accessor that preserves the record's type parameter `T` on
 * the `json()` method.
 *
 * All other methods (`blob`, `bytes`, `text`, `stream`, `then`, `catch`)
 * are forwarded unchanged from the underlying {@link RecordData}.
 */
export type TypedRecordData<T> = Omit<RecordData, 'json'> & {
    /** Parse the data as JSON, returning the typed data shape `T`. */
    json: () => Promise<T>;
};
/**
 * Update parameters for a {@link TypedRecord}.
 *
 * Extends the base `RecordUpdateParams` but narrows `data` from `unknown`
 * to `Partial<T>`.
 */
export type TypedRecordUpdateParams<T> = Omit<RecordUpdateParams, 'data'> & {
    /** The new data for the record. Type-checked against the schema map. */
    data?: Partial<T>;
};
/**
 * Result of a {@link TypedRecord.update} operation.
 */
export type TypedRecordUpdateResult<T> = DwnResponseStatus & {
    /** The updated record, carrying the same type parameter. */
    record: TypedRecord<T>;
};
/**
 * Result of a {@link TypedRecord.delete} operation.
 */
export type TypedRecordDeleteResult<T> = DwnResponseStatus & {
    /** The deleted record, carrying the same type parameter. */
    record: TypedRecord<T>;
};
/**
 * A type-safe wrapper around {@link Record} that preserves the data type `T`.
 *
 * Obtain instances through `TypedWeb5.records.write()`, `.query()`, `.read()`,
 * or `.subscribe()` — never construct directly.
 */
export declare class TypedRecord<T> {
    /** The underlying untyped Record instance. */
    private _record;
    constructor(record: Record);
    /** Access the underlying untyped {@link Record} for advanced use cases. */
    get rawRecord(): Record;
    /**
     * Returns the data of the current record with type-safe accessors.
     *
     * The `json()` method returns `Promise<T>` — no manual generic needed.
     *
     * @throws `Error` if the record has been deleted.
     */
    get data(): TypedRecordData<T>;
    /**
     * Update the current record on the DWN.
     *
     * @param params - Parameters including the typed `data` payload.
     * @returns The status and an updated {@link TypedRecord}.
     * @throws `Error` if the record has been deleted.
     */
    update(params: TypedRecordUpdateParams<T>): Promise<TypedRecordUpdateResult<T>>;
    /**
     * Delete the current record on the DWN.
     *
     * @param params - Delete parameters.
     * @returns The status and a {@link TypedRecord} reflecting the deleted state.
     */
    delete(params?: RecordDeleteParams): Promise<TypedRecordDeleteResult<T>>;
    /**
     * Stores the current record state to the owner's DWN.
     *
     * @param importRecord - If true, sign as owner before storing. Defaults to false.
     */
    store(importRecord?: boolean): Promise<DwnResponseStatus>;
    /**
     * Signs and optionally stores the record to the owner's DWN.
     * Useful when importing a record signed by someone else.
     *
     * @param store - If true, store after signing. Defaults to true.
     */
    import(store?: boolean): Promise<DwnResponseStatus>;
    /**
     * Send the current record to a remote DWN.
     *
     * @param target - Optional DID of the target DWN. Defaults to the connected DID.
     */
    send(target?: string): Promise<DwnResponseStatus>;
    /**
     * Returns a JSON representation of the Record instance.
     */
    toJSON(): RecordModel;
    /**
     * Returns a string representation of the Record instance.
     */
    toString(): string;
    /**
     * Returns a pagination cursor for the current record given a sort order.
     */
    paginationCursor(sort: DwnDateSort): Promise<DwnPaginationCursor | undefined>;
    /** Record's ID. */
    get id(): string;
    /** Record's context ID. */
    get contextId(): string | undefined;
    /** Record's creation date. */
    get dateCreated(): string;
    /** Record's parent ID. */
    get parentId(): string | undefined;
    /** Record's protocol. */
    get protocol(): string | undefined;
    /** Record's protocol path. */
    get protocolPath(): string | undefined;
    /** Record's recipient. */
    get recipient(): string | undefined;
    /** Record's schema. */
    get schema(): string | undefined;
    /** Record's data format. */
    get dataFormat(): string | undefined;
    /** Record's data CID. */
    get dataCid(): string | undefined;
    /** Record's data size. */
    get dataSize(): number | undefined;
    /** Record's published date. */
    get datePublished(): string | undefined;
    /** Record's published status. */
    get published(): boolean | undefined;
    /** Tags of the record. */
    get tags(): DwnMessage[DwnInterface.RecordsWrite]['descriptor']['tags'] | undefined;
    /** DID that is the logical author of the Record. */
    get author(): string;
    /** DID that is the original creator of the Record. */
    get creator(): string;
    /** Record's message timestamp. */
    get timestamp(): string;
    /** Record's encryption details. */
    get encryption(): DwnMessage[DwnInterface.RecordsWrite]['encryption'];
    /** Record's authorization. */
    get authorization(): DwnMessage[DwnInterface.RecordsWrite | DwnInterface.RecordsDelete]['authorization'];
    /** Record's attestation. */
    get attestation(): DwnMessage[DwnInterface.RecordsWrite]['attestation'] | undefined;
    /** Role under which the author is writing the record. */
    get protocolRole(): string | undefined;
    /** Record's deleted state. */
    get deleted(): boolean;
    /** Record's initial write if the record has been updated. */
    get initialWrite(): DwnMessage[DwnInterface.RecordsWrite] | undefined;
    /** The raw DWN message backing this record. */
    get rawMessage(): DwnMessage[DwnInterface.RecordsWrite] | DwnMessage[DwnInterface.RecordsDelete];
}
//# sourceMappingURL=typed-record.d.ts.map