import type { DidService } from '@enbox/dids';
import type { RequireOnly } from '@enbox/common';
import type { GenericMessageReply, MessagesReadMessage, MessagesReadOptions, MessagesReadReply, MessagesSubscribeMessage, MessagesSubscribeOptions, MessagesSubscribeReply, MessagesSyncMessage, MessagesSyncReply, ProtocolsConfigureMessage, ProtocolsConfigureOptions, ProtocolsQueryMessage, ProtocolsQueryOptions, ProtocolsQueryReply, RecordsDeleteMessage, RecordsDeleteOptions, RecordsQueryMessage, RecordsQueryOptions, RecordsQueryReply, RecordsReadMessage, RecordsReadOptions, RecordsReadReply, RecordsSubscribeMessage, RecordsSubscribeOptions, RecordsSubscribeReply, RecordsWriteMessage, RecordsWriteOptions, SubscriptionListener } from '@enbox/dwn-sdk-js';
import type { MessagesSyncOptions } from '@enbox/dwn-sdk-js';
import { MessagesRead, MessagesSubscribe, MessagesSync, ProtocolsConfigure, ProtocolsQuery, RecordsDelete, RecordsQuery, RecordsRead, RecordsSubscribe, RecordsWrite } from '@enbox/dwn-sdk-js';
/**
 * Represents a Decentralized Web Node (DWN) service in a DID Document.
 *
 * A DWN DID service is a specialized type of DID service with the `type` set to
 * `DecentralizedWebNode`. Encryption and signing keys are resolved from the DID document's
 * verification methods, not from the service entry.
 *
 * The `enc` and `sig` properties are optional legacy fields that may be present on existing
 * DID documents for backward compatibility. New implementations should resolve keys from the
 * DID document's verification methods by purpose (`keyAgreement` for encryption,
 * `authentication`/`assertionMethod` for signing).
 *
 * @example
 * ```ts
 * const service: DwnDidService = {
 *   id: 'did:example:123#dwn',
 *   type: 'DecentralizedWebNode',
 *   serviceEndpoint: 'https://enbox-dwn.fly.dev'
 * }
 * ```
 *
 * @see {@link https://github.com/enboxorg/dwn-spec | Enbox DWN Specification}
 */
export interface DwnDidService extends DidService {
}
export declare enum DwnInterface {
    MessagesRead = "MessagesRead",
    MessagesSubscribe = "MessagesSubscribe",
    MessagesSync = "MessagesSync",
    ProtocolsConfigure = "ProtocolsConfigure",
    ProtocolsQuery = "ProtocolsQuery",
    RecordsDelete = "RecordsDelete",
    RecordsQuery = "RecordsQuery",
    RecordsRead = "RecordsRead",
    RecordsSubscribe = "RecordsSubscribe",
    RecordsWrite = "RecordsWrite"
}
export type DwnRecordsInterfaces = DwnInterface.RecordsDelete | DwnInterface.RecordsQuery | DwnInterface.RecordsRead | DwnInterface.RecordsSubscribe | DwnInterface.RecordsWrite;
export interface DwnMessage {
    [DwnInterface.MessagesRead]: MessagesReadMessage;
    [DwnInterface.MessagesSubscribe]: MessagesSubscribeMessage;
    [DwnInterface.MessagesSync]: MessagesSyncMessage;
    [DwnInterface.ProtocolsConfigure]: ProtocolsConfigureMessage;
    [DwnInterface.ProtocolsQuery]: ProtocolsQueryMessage;
    [DwnInterface.RecordsDelete]: RecordsDeleteMessage;
    [DwnInterface.RecordsQuery]: RecordsQueryMessage;
    [DwnInterface.RecordsRead]: RecordsReadMessage;
    [DwnInterface.RecordsSubscribe]: RecordsSubscribeMessage;
    [DwnInterface.RecordsWrite]: RecordsWriteMessage;
}
export interface DwnMessageDescriptor {
    [DwnInterface.MessagesRead]: MessagesReadMessage['descriptor'];
    [DwnInterface.MessagesSubscribe]: MessagesSubscribeMessage['descriptor'];
    [DwnInterface.MessagesSync]: MessagesSyncMessage['descriptor'];
    [DwnInterface.ProtocolsConfigure]: ProtocolsConfigureMessage['descriptor'];
    [DwnInterface.ProtocolsQuery]: ProtocolsQueryMessage['descriptor'];
    [DwnInterface.RecordsDelete]: RecordsDeleteMessage['descriptor'];
    [DwnInterface.RecordsQuery]: RecordsQueryMessage['descriptor'];
    [DwnInterface.RecordsRead]: RecordsReadMessage['descriptor'];
    [DwnInterface.RecordsSubscribe]: RecordsSubscribeMessage['descriptor'];
    [DwnInterface.RecordsWrite]: RecordsWriteMessage['descriptor'];
}
export interface DwnMessageParams {
    [DwnInterface.MessagesRead]: RequireOnly<MessagesReadOptions, 'messageCid'>;
    [DwnInterface.MessagesSubscribe]: Partial<MessagesSubscribeOptions>;
    [DwnInterface.MessagesSync]: RequireOnly<MessagesSyncOptions, 'action'>;
    [DwnInterface.ProtocolsConfigure]: RequireOnly<ProtocolsConfigureOptions, 'definition'>;
    [DwnInterface.ProtocolsQuery]: ProtocolsQueryOptions;
    [DwnInterface.RecordsDelete]: RequireOnly<RecordsDeleteOptions, 'recordId'>;
    [DwnInterface.RecordsQuery]: RecordsQueryOptions;
    [DwnInterface.RecordsRead]: RecordsReadOptions;
    [DwnInterface.RecordsSubscribe]: RecordsSubscribeOptions;
    [DwnInterface.RecordsWrite]: RecordsWriteOptions;
}
export interface DwnMessageReply {
    [DwnInterface.MessagesRead]: MessagesReadReply;
    [DwnInterface.MessagesSubscribe]: MessagesSubscribeReply;
    [DwnInterface.MessagesSync]: MessagesSyncReply;
    [DwnInterface.ProtocolsConfigure]: GenericMessageReply;
    [DwnInterface.ProtocolsQuery]: ProtocolsQueryReply;
    [DwnInterface.RecordsDelete]: GenericMessageReply;
    [DwnInterface.RecordsQuery]: RecordsQueryReply;
    [DwnInterface.RecordsRead]: RecordsReadReply;
    [DwnInterface.RecordsSubscribe]: RecordsSubscribeReply;
    [DwnInterface.RecordsWrite]: GenericMessageReply;
}
export interface MessageHandler {
    [DwnInterface.MessagesSubscribe]: SubscriptionListener;
    [DwnInterface.RecordsSubscribe]: SubscriptionListener;
    [DwnInterface.MessagesRead]: undefined;
    [DwnInterface.MessagesSync]: undefined;
    [DwnInterface.ProtocolsConfigure]: undefined;
    [DwnInterface.ProtocolsQuery]: undefined;
    [DwnInterface.RecordsDelete]: undefined;
    [DwnInterface.RecordsQuery]: undefined;
    [DwnInterface.RecordsRead]: undefined;
    [DwnInterface.RecordsWrite]: undefined;
}
export type DwnRequest<T extends DwnInterface> = {
    author: string;
    target: string;
    messageType: T;
};
/**
 * Defines the structure for response status, including a status code and detail message.
 */
export type DwnResponseStatus = {
    /** Encapsulates the outcome of an operation, providing both a numeric status code and a descriptive message. */
    status: {
        /** Numeric status code representing the outcome of the operation. */
        code: number;
        /** Descriptive detail about the status or error. */
        detail: string;
    };
};
export type ProcessDwnRequest<T extends DwnInterface> = DwnRequest<T> & {
    dataStream?: Blob | ReadableStream;
    rawMessage?: DwnMessage[T];
    messageParams?: DwnMessageParams[T];
    store?: boolean;
    signAsOwner?: boolean;
    signAsOwnerDelegate?: boolean;
    granteeDid?: string;
    subscriptionHandler?: MessageHandler[T];
    /**
     * If true, automatically encrypt protocol records and inject $encryption keys.
      * Requires the identity to have an X25519 keyAgreement key.
     */
    encryption?: boolean;
};
export type SendDwnRequest<T extends DwnInterface> = DwnRequest<T> & (ProcessDwnRequest<T> | {
    messageCid: string;
});
export type DwnResponse<T extends DwnInterface> = {
    message?: DwnMessage[T];
    messageCid: string;
    reply: DwnMessageReply[T];
};
/**
 * Per-DWN-interface message factory. Only the static `create` and `parse`
 * methods are part of the contract — the underlying classes have private
 * or protected constructors (factory pattern), so the interface
 * intentionally does not declare `new ()`. Omitting `new ()` lets the
 * mapped-type table below assign class values directly without casts:
 * a class with a private constructor still satisfies a structural type
 * that doesn't require constructability, as long as the static side
 * (`create` / `parse`) lines up.
 */
export interface DwnMessageConstructor<T extends DwnInterface> {
    create(params: DwnMessageParams[T]): Promise<DwnMessageInstance[T]>;
    parse(rawMessage: DwnMessage[T]): Promise<DwnMessageInstance[T]>;
}
export declare const dwnMessageConstructors: {
    [T in DwnInterface]: DwnMessageConstructor<T>;
};
export interface DwnMessageInstance {
    [DwnInterface.MessagesRead]: MessagesRead;
    [DwnInterface.MessagesSubscribe]: MessagesSubscribe;
    [DwnInterface.MessagesSync]: MessagesSync;
    [DwnInterface.ProtocolsConfigure]: ProtocolsConfigure;
    [DwnInterface.ProtocolsQuery]: ProtocolsQuery;
    [DwnInterface.RecordsDelete]: RecordsDelete;
    [DwnInterface.RecordsQuery]: RecordsQuery;
    [DwnInterface.RecordsRead]: RecordsRead;
    [DwnInterface.RecordsSubscribe]: RecordsSubscribe;
    [DwnInterface.RecordsWrite]: RecordsWrite;
}
export type DwnMessageWithData<T extends DwnInterface> = {
    message: DwnMessage[T];
    dataStream?: ReadableStream<Uint8Array>;
};
export { DateSort as DwnDateSort, DwnConstant, ContentEncryptionAlgorithm as DwnContentEncryptionAlgorithm, KeyDerivationScheme as DwnKeyDerivationScheme, PermissionGrant as DwnPermissionGrant, PermissionRequest as DwnPermissionRequest, PermissionsProtocol as DwnPermissionsProtocol, } from '@enbox/dwn-sdk-js';
export type { DataEncodedRecordsWriteMessage as DwnDataEncodedRecordsWriteMessage, MessageSigner as DwnSigner, MessageSubscription as DwnMessageSubscription, MessagesPermissionScope as DwnMessagesPermissionScope, PaginationCursor as DwnPaginationCursor, PermissionConditions as DwnPermissionConditions, PermissionGrantData as DwnPermissionGrantData, PermissionRequestData as DwnPermissionRequestData, PermissionScope as DwnPermissionScope, ProtocolDefinition as DwnProtocolDefinition, ProtocolPermissionScope as DwnProtocolPermissionScope, PublicKeyJwk as DwnPublicKeyJwk, RecordsPermissionScope as DwnRecordsPermissionScope, SubscriptionListener as DwnSubscriptionListener, SubscriptionMessage as DwnSubscriptionMessage, } from '@enbox/dwn-sdk-js';
//# sourceMappingURL=dwn.d.ts.map