import { FMTable } from '../orm.js';
import { Column } from '../orm/column.js';
import { FilterExpression } from '../orm/operators.js';
import { FMODataLayer } from '../services.js';
import { ExecuteMethodOptions } from '../types.js';
export interface Webhook<TableName = string> {
    webhook: string;
    headers?: Record<string, string>;
    tableName: TableName;
    notifySchemaChanges?: boolean;
    select?: string | Column<any, any, any>[];
    filter?: string | FilterExpression;
}
/**
 * Webhook information returned by the API
 */
export interface WebhookInfo {
    webhookID: number;
    tableName: string;
    webhook: string;
    headers?: Record<string, string>;
    notifySchemaChanges: boolean;
    select: string;
    filter: string;
    pendingOperations: unknown[];
}
/**
 * Response from listing all webhooks
 */
export interface WebhookListResponse {
    status: string;
    webhooks: WebhookInfo[];
}
/**
 * Response from adding a webhook
 */
export interface WebhookAddResponse {
    webhookResult: {
        webhookID: number;
    };
}
export declare class WebhookManager {
    private readonly layer;
    private readonly config;
    constructor(layer: FMODataLayer);
    /**
     * Adds a new webhook to the database.
     * @param webhook - The webhook configuration object
     * @param webhook.webhook - The webhook URL to call
     * @param webhook.tableName - The FMTable instance for the table to monitor
     * @param webhook.headers - Optional custom headers to include in webhook requests
     * @param webhook.notifySchemaChanges - Whether to notify on schema changes
     * @param webhook.select - Optional field selection (string or array of Column references)
     * @param webhook.filter - Optional filter (string or FilterExpression)
     * @returns Promise resolving to the created webhook data with ID
     * @example
     * ```ts
     * const result = await db.webhook.add({
     *   webhook: "https://example.com/webhook",
     *   tableName: contactsTable,
     *   headers: { "X-Custom-Header": "value" },
     * });
     * // result.webhookResult.webhookID contains the new webhook ID
     * ```
     * @example
     * ```ts
     * // Using filter expressions and column arrays (same DX as query builder)
     * const result = await db.webhook.add({
     *   webhook: "https://example.com/webhook",
     *   tableName: contacts,
     *   filter: eq(contacts.name, "John"),
     *   select: [contacts.name, contacts.PrimaryKey],
     * });
     * ```
     */
    add(webhook: Webhook<FMTable>, options?: ExecuteMethodOptions): Promise<WebhookAddResponse>;
    /**
     * Deletes a webhook by ID.
     * @param webhookId - The ID of the webhook to delete
     * @returns Promise that resolves when the webhook is deleted
     * @example
     * ```ts
     * await db.webhook.remove(1);
     * ```
     */
    remove(webhookId: number, options?: ExecuteMethodOptions): Promise<void>;
    /**
     * Gets a webhook by ID.
     * @param webhookId - The ID of the webhook to retrieve
     * @returns Promise resolving to the webhook data
     * @example
     * ```ts
     * const webhook = await db.webhook.get(1);
     * // webhook.webhookID, webhook.tableName, webhook.webhook, etc.
     * ```
     */
    get(webhookId: number, options?: ExecuteMethodOptions): Promise<WebhookInfo>;
    /**
     * Lists all webhooks.
     * @returns Promise resolving to webhook list response with status and webhooks array
     * @example
     * ```ts
     * const result = await db.webhook.list();
     * // result.status contains the status
     * // result.webhooks contains the array of webhooks
     * ```
     */
    list(options?: ExecuteMethodOptions): Promise<WebhookListResponse>;
    /**
     * Invokes a webhook by ID, optionally for specific row IDs.
     * @param webhookId - The ID of the webhook to invoke
     * @param options - Optional configuration
     * @param options.rowIDs - Array of row IDs to trigger the webhook for
     * @returns Promise resolving to the invocation result (type unknown until API behavior is confirmed)
     * @example
     * ```ts
     * // Invoke for all rows
     * await db.webhook.invoke(1);
     *
     * // Invoke for specific rows
     * await db.webhook.invoke(1, { rowIDs: [63, 61] });
     * ```
     */
    invoke(webhookId: number, options?: {
        rowIDs?: number[];
    }, executeOptions?: ExecuteMethodOptions): Promise<unknown>;
}
