export * from "./service.js";
export * from "./types.js";
import { EmailStorageService, } from "./service.js";
import { getServiceUrls } from '@agentuity/config';
import { createServiceAdapter, isLogger, resolveApiKey, resolveRegion, resolveServiceUrl, } from '@agentuity/client';
import { z } from 'zod';
export const EmailClientOptionsSchema = z.object({
    apiKey: z.string().optional().describe('API key for authentication'),
    url: z.string().optional().describe('Base URL for the Email API'),
    orgId: z.string().optional().describe('Organization ID for multi-tenant operations'),
    logger: z.custom(isLogger).optional().describe('Custom logger instance'),
});
export class EmailClient {
    #service;
    constructor(options = {}) {
        const validatedOptions = EmailClientOptionsSchema.parse(options);
        const serviceUrls = getServiceUrls(resolveRegion());
        const url = resolveServiceUrl({
            url: validatedOptions.url,
            envKey: 'AGENTUITY_EMAIL_URL',
            fallback: serviceUrls.email,
        });
        const { adapter } = createServiceAdapter({
            apiKey: resolveApiKey(validatedOptions.apiKey),
            orgId: validatedOptions.orgId,
            logger: validatedOptions.logger,
        });
        this.#service = new EmailStorageService(url, adapter);
    }
    async createAddress(localPart) {
        return this.#service.createAddress(localPart);
    }
    async listAddresses() {
        return this.#service.listAddresses();
    }
    async getAddress(id) {
        return this.#service.getAddress(id);
    }
    async getConnectionConfig(id) {
        return this.#service.getConnectionConfig(id);
    }
    async deleteAddress(id) {
        return this.#service.deleteAddress(id);
    }
    async createDestination(addressId, type, config) {
        return this.#service.createDestination(addressId, type, config);
    }
    async listDestinations(addressId) {
        return this.#service.listDestinations(addressId);
    }
    async deleteDestination(addressId, destinationId) {
        return this.#service.deleteDestination(addressId, destinationId);
    }
    async send(params) {
        return this.#service.send(params);
    }
    async listInbound(addressId) {
        return this.#service.listInbound(addressId);
    }
    async getInbound(id) {
        return this.#service.getInbound(id);
    }
    async deleteInbound(id) {
        return this.#service.deleteInbound(id);
    }
    async listOutbound(addressId) {
        return this.#service.listOutbound(addressId);
    }
    async getOutbound(id) {
        return this.#service.getOutbound(id);
    }
    async deleteOutbound(id) {
        return this.#service.deleteOutbound(id);
    }
    async getActivity(params) {
        return this.#service.getActivity(params);
    }
}
//# sourceMappingURL=index.js.map