export * from "./service.js";
import { StreamStorageService, } from "./service.js";
import { getServiceUrls } from '@agentuity/config';
import { createServiceAdapter, isLogger, resolveApiKey, resolveRegion, resolveServiceUrl, } from '@agentuity/client';
import { z } from 'zod';
export const StreamClientOptionsSchema = z.object({
    apiKey: z.string().optional().describe('API key for authentication'),
    url: z.string().optional().describe('Base URL for the Stream API'),
    orgId: z.string().optional().describe('Organization ID for multi-tenant operations'),
    logger: z.custom(isLogger).optional().describe('Custom logger instance'),
});
export class StreamClient {
    #service;
    constructor(options = {}) {
        const validatedOptions = StreamClientOptionsSchema.parse(options);
        const serviceUrls = getServiceUrls(resolveRegion());
        const url = resolveServiceUrl({
            url: validatedOptions.url,
            envKey: 'AGENTUITY_STREAM_URL',
            fallback: serviceUrls.stream,
        });
        const { adapter } = createServiceAdapter({
            apiKey: resolveApiKey(validatedOptions.apiKey),
            orgId: validatedOptions.orgId,
            logger: validatedOptions.logger,
        });
        this.#service = new StreamStorageService(url, adapter);
    }
    /**
     * Create a new stream for writing data that can be read multiple times
     */
    async create(namespace, props) {
        return this.#service.create(namespace, props);
    }
    /**
     * Get stream metadata by ID
     */
    async get(id) {
        return this.#service.get(id);
    }
    /**
     * Download stream content
     */
    async download(id) {
        return this.#service.download(id);
    }
    /**
     * List streams with optional filtering and pagination
     */
    async list(params) {
        return this.#service.list(params);
    }
    /**
     * Delete a stream by its ID
     */
    async delete(id) {
        return this.#service.delete(id);
    }
}
//# sourceMappingURL=index.js.map