import { Db } from 'mongodb';
import { Connector, DataConnector, ConnectorExecutionContext } from '@evolutese/runtime';

type AnyDoc = Record<string, any>;
declare class MongoConnector implements Connector, DataConnector {
    private db;
    private defaultCollection;
    constructor(db: Db, defaultCollection?: string);
    private getCollection;
    insert(table: string, doc: AnyDoc): Promise<any>;
    find(table: string, filter?: AnyDoc): Promise<any[]>;
    update(table: string, filter: AnyDoc, data: AnyDoc): Promise<any>;
    delete(table: string, filter: AnyDoc): Promise<any>;
    execute(params: any, _context?: ConnectorExecutionContext): Promise<any>;
    test(): Promise<{
        success: boolean;
        message?: string;
    }>;
}
declare class InMemoryMongoConnector implements Connector, DataConnector {
    private documents;
    private idCounter;
    private defaultCollection;
    constructor(defaultCollection?: string);
    private getTable;
    private matches;
    insert(table: string, doc: AnyDoc): Promise<any>;
    find(table: string, filter?: AnyDoc): Promise<any[]>;
    update(table: string, filter: AnyDoc, data: AnyDoc): Promise<any>;
    delete(table: string, filter: AnyDoc): Promise<any>;
    execute(params: any, _context?: ConnectorExecutionContext): Promise<any>;
    test(): Promise<{
        success: boolean;
        message?: string;
    }>;
}
/**
 * Factory — returns a real MongoConnector if a Db instance is provided,
 * otherwise falls back to InMemoryMongoConnector (useful for dev/testing).
 */
declare function buildMongoConnector(db: Db | null | undefined, defaultCollection?: string): Connector;
/**
 * Async factory that accepts a config object.
 * Falls back to in-memory when no connectionString is provided.
 *
 * @example
 * const mongo = await buildMongoConnectorFromConfig({
 *   connectionString: process.env.MONGO_URI,
 *   dbName: "mydb",
 * });
 */
declare function buildMongoConnectorFromConfig(config: {
    connectionString?: string;
    dbName?: string;
    defaultCollection?: string;
    provider?: string;
}): Promise<Connector>;

interface MailConnectorConfig {
    host: string;
    port?: number;
    secure?: boolean;
    auth?: {
        user: string;
        pass: string;
    };
    from?: string;
}
interface MailActionParams {
    to: string | string[];
    subject: string;
    body: string;
    html?: string;
    from?: string;
    cc?: string | string[];
    bcc?: string | string[];
}
declare class MailConnector implements Connector<MailActionParams> {
    private transporter;
    private defaultFrom;
    constructor(config?: MailConnectorConfig);
    private static configFromEnv;
    execute(params: MailActionParams, context?: ConnectorExecutionContext): Promise<Record<string, unknown>>;
    test(_config?: Record<string, unknown>): Promise<{
        success: boolean;
        message?: string;
    }>;
}

export { InMemoryMongoConnector, type MailActionParams, MailConnector, type MailConnectorConfig, MongoConnector, buildMongoConnector, buildMongoConnectorFromConfig };
