/**
 * @module queue
 *
 * Queue service for publishing messages to Agentuity queues.
 *
 * Used internally by `@agentuity/queue`'s `QueueClient`. App code should
 * use `QueueClient` directly rather than reaching for these primitives.
 *
 * @example
 * ```typescript
 * import { QueueClient } from '@agentuity/queue';
 *
 * const queue = new QueueClient();
 * const result = await queue.publish('order-queue', {
 *   orderId: 123,
 *   action: 'process',
 * });
 * console.log(`Published message ${result.id}`);
 * ```
 */
import type { FetchAdapter } from '@agentuity/adapter';
import { z } from 'zod';
/**
 * Parameters for publishing a message to a queue.
 *
 * @example
 * ```typescript
 * const params: QueuePublishParams = {
 *   metadata: { priority: 'high' },
 *   partitionKey: 'customer-123',
 *   idempotencyKey: 'order-456-v1',
 *   ttl: 3600, // 1 hour
 * };
 * ```
 */
export declare const QueuePublishParamsSchema: z.ZodObject<{
    metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
    partitionKey: z.ZodOptional<z.ZodString>;
    idempotencyKey: z.ZodOptional<z.ZodString>;
    ttl: z.ZodOptional<z.ZodNumber>;
    projectId: z.ZodOptional<z.ZodString>;
    agentId: z.ZodOptional<z.ZodString>;
    sync: z.ZodOptional<z.ZodBoolean>;
}, z.core.$strip>;
export type QueuePublishParams = z.infer<typeof QueuePublishParamsSchema>;
/**
 * Result of publishing a message to a queue.
 *
 * @example
 * ```typescript
 * const result = await queue.publish('my-queue', payload);
 * console.log(`Message ${result.id} published at offset ${result.offset}`);
 * ```
 */
export declare const QueuePublishResultSchema: z.ZodObject<{
    id: z.ZodString;
    offset: z.ZodNumber;
    publishedAt: z.ZodString;
}, z.core.$strip>;
export type QueuePublishResult = z.infer<typeof QueuePublishResultSchema>;
/**
 * Parameters for creating a queue.
 *
 * @example
 * ```typescript
 * const result = await queue.createQueue('my-queue', {
 *   queueType: 'pubsub',
 *   settings: { defaultTtlSeconds: 86400 },
 * });
 * ```
 */
export declare const QueueCreateParamsSchema: z.ZodObject<{
    queueType: z.ZodOptional<z.ZodEnum<{
        worker: "worker";
        pubsub: "pubsub";
    }>>;
    description: z.ZodOptional<z.ZodString>;
    settings: z.ZodOptional<z.ZodObject<{
        defaultTtlSeconds: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
        defaultVisibilityTimeoutSeconds: z.ZodOptional<z.ZodNumber>;
        defaultMaxRetries: z.ZodOptional<z.ZodNumber>;
        maxInFlightPerClient: z.ZodOptional<z.ZodNumber>;
        retentionSeconds: z.ZodOptional<z.ZodNumber>;
    }, z.core.$strip>>;
}, z.core.$strip>;
export type QueueCreateParams = z.infer<typeof QueueCreateParamsSchema>;
/**
 * Result of creating a queue.
 */
export declare const QueueCreateResultSchema: z.ZodObject<{
    name: z.ZodString;
    queueType: z.ZodString;
}, z.core.$strip>;
export type QueueCreateResult = z.infer<typeof QueueCreateResultSchema>;
/**
 * Queue service interface for publishing messages.
 *
 * Provides a simple publish-only surface suitable for app handlers.
 * Implemented by `QueueStorageService` (cloud) and `LocalQueueStorage`
 * (local dev).
 *
 * For full queue management (create queues, consume messages, manage
 * destinations), use the `@agentuity/queue` package directly.
 *
 * @example
 * ```typescript
 * import { QueueClient } from '@agentuity/queue';
 *
 * const queue = new QueueClient();
 *
 * await queue.publish('notifications', {
 *   type: 'email',
 *   to: 'user@example.com',
 *   subject: 'Welcome!',
 * });
 * ```
 */
export interface QueueService {
    /**
     * Publish a message to a queue.
     *
     * The payload can be a string or an object. Objects are automatically
     * JSON-stringified before publishing.
     *
     * @param queueName - The name of the queue to publish to
     * @param payload - The message payload (string or JSON-serializable object)
     * @param params - Optional publish parameters (metadata, TTL, etc.)
     * @returns The publish result with message ID and offset
     * @throws {QueueNotFoundError} If the queue does not exist
     * @throws {QueueValidationError} If validation fails (invalid name, payload too large, etc.)
     * @throws {QueuePublishError} If the publish operation fails
     *
     * @example Publishing a simple message
     * ```typescript
     * const result = await queue.publish('my-queue', 'Hello, World!');
     * ```
     *
     * @example Publishing with options
     * ```typescript
     * const result = await queue.publish('my-queue', { task: 'process' }, {
     *   metadata: { priority: 'high' },
     *   idempotencyKey: 'task-123',
     *   ttl: 3600,
     * });
     * ```
     */
    publish(queueName: string, payload: string | object, params?: QueuePublishParams): Promise<QueuePublishResult>;
    /**
     * Create a queue with idempotent semantics.
     *
     * If the queue already exists, this returns successfully without error.
     * Safe to call multiple times — uses an internal cache to avoid redundant API calls.
     *
     * @param queueName - The name of the queue to create
     * @param params - Optional creation parameters (queue type, settings, etc.)
     * @returns The create result with queue name and type
     * @throws {QueueValidationError} If the queue name is invalid
     *
     * @example Creating a worker queue
     * ```typescript
     * const result = await queue.createQueue('task-queue');
     * ```
     *
     * @example Creating a pubsub queue with settings
     * ```typescript
     * const result = await queue.createQueue('events', {
     *   queueType: 'pubsub',
     *   settings: { defaultTtlSeconds: 86400 },
     * });
     * ```
     */
    createQueue(queueName: string, params?: QueueCreateParams): Promise<QueueCreateResult>;
    /**
     * Delete a queue.
     *
     * Permanently deletes a queue and all its messages. This action cannot be undone.
     * If the queue has already been deleted or does not exist, a {@link QueueNotFoundError} is thrown.
     *
     * @param queueName - The name of the queue to delete
     * @throws {QueueNotFoundError} If the queue does not exist
     * @throws {QueueValidationError} If the queue name is invalid
     *
     * @example Deleting a queue
     * ```typescript
     * await queue.deleteQueue('old-queue');
     * ```
     */
    deleteQueue(queueName: string): Promise<void>;
}
/**
 * Error thrown when a publish operation fails.
 *
 * This is a general error for publish failures that aren't specifically
 * validation or not-found errors.
 */
export declare const QueuePublishError: {
    new (args?: {
        message?: string;
        cause?: unknown;
    } | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueuePublishError";
    } & Readonly<Record<string, never>>;
    readonly defaultMessage?: string;
} & (<Shape extends {
    [x: string]: any;
} = Record<string, never>>() => {
    new (args?: (Shape extends Record<string, never> ? {
        message?: string;
        cause?: unknown;
    } : Shape & {
        message?: string;
        cause?: unknown;
    }) | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueuePublishError";
    } & Readonly<Shape>;
    readonly defaultMessage?: string;
});
/**
 * Error thrown when a queue creation operation fails.
 *
 * This is a general error for create failures that aren't specifically
 * validation, not-found, or conflict (409) errors.
 */
export declare const QueueCreateError: {
    new (args?: {
        message?: string;
        cause?: unknown;
    } | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueueCreateError";
    } & Readonly<Record<string, never>>;
    readonly defaultMessage?: string;
} & (<Shape extends {
    [x: string]: any;
} = Record<string, never>>() => {
    new (args?: (Shape extends Record<string, never> ? {
        message?: string;
        cause?: unknown;
    } : Shape & {
        message?: string;
        cause?: unknown;
    }) | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueueCreateError";
    } & Readonly<Shape>;
    readonly defaultMessage?: string;
});
/**
 * Error thrown when a queue is not found.
 *
 * @example
 * ```typescript
 * try {
 *   await queue.publish('non-existent', 'payload');
 * } catch (error) {
 *   if (error instanceof QueueNotFoundError) {
 *     console.error('Queue does not exist');
 *   }
 * }
 * ```
 */
export declare const QueueNotFoundError: {
    new (args?: {
        message?: string;
        cause?: unknown;
    } | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueueNotFoundError";
    } & Readonly<Record<string, never>>;
    readonly defaultMessage?: string;
} & (<Shape extends {
    [x: string]: any;
} = Record<string, never>>() => {
    new (args?: (Shape extends Record<string, never> ? {
        message?: string;
        cause?: unknown;
    } : Shape & {
        message?: string;
        cause?: unknown;
    }) | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueueNotFoundError";
    } & Readonly<Shape>;
    readonly defaultMessage?: string;
});
/**
 * Error thrown when validation fails.
 *
 * Contains the field name and optionally the invalid value for debugging.
 */
export declare const QueueValidationError: {
    new (args?: ({
        /** The field that failed validation */
        field: string;
        /** The invalid value (for debugging) */
        value?: unknown;
    } & {
        message?: string;
        cause?: unknown;
    }) | undefined): import("@agentuity/adapter").RichError & {
        readonly _tag: "QueueValidationError";
    } & Readonly<{
        /** The field that failed validation */
        field: string;
        /** The invalid value (for debugging) */
        value?: unknown;
    }>;
    readonly defaultMessage?: string;
};
/**
 * HTTP-based implementation of the {@link QueueService} interface.
 *
 * This service communicates with the Agentuity Queue API to publish
 * messages. App code should use `QueueClient` from `@agentuity/queue`
 * rather than instantiating this class directly.
 */
export declare class QueueStorageService implements QueueService {
    #private;
    /**
     * Creates a new QueueStorageService.
     *
     * @param baseUrl - The base URL of the Queue API
     * @param adapter - The fetch adapter for making HTTP requests
     */
    constructor(baseUrl: string, adapter: FetchAdapter);
    /**
     * @inheritdoc
     */
    publish(queueName: string, payload: string | object, params?: QueuePublishParams): Promise<QueuePublishResult>;
    /**
     * @inheritdoc
     */
    createQueue(queueName: string, params?: QueueCreateParams): Promise<QueueCreateResult>;
    /**
     * @inheritdoc
     */
    deleteQueue(queueName: string): Promise<void>;
}
//# sourceMappingURL=service.d.ts.map