import * as drizzle_orm_pg_core from 'drizzle-orm/pg-core';
import { InferSelectModel } from 'drizzle-orm';

/**
 * Direction of a integration run relative to local state.
 *
 *   - `inbound`  — external → local (the common case: SFDC poll → local DB).
 *   - `outbound` — local → external (writeback; deferred per epic but the
 *     column shape is reserved so future writeback runs share the audit log).
 */
declare const integrationRunDirectionEnum: drizzle_orm_pg_core.PgEnum<["inbound", "outbound"]>;
/**
 * How the run detected upstream changes. Maps 1:1 to the `Change.source`
 * provenance on inbound runs; `manual` captures operator-triggered re-integrations
 * and `writeback` captures outbound runs.
 */
declare const integrationRunActionEnum: drizzle_orm_pg_core.PgEnum<["poll", "cdc", "webhook", "manual", "writeback"]>;
/**
 * Lifecycle status of a integration run.
 *
 *   - `running`     — in-flight; recorder has started but not completed.
 *   - `success`     — completed with at least one change processed.
 *   - `no_changes`  — completed cleanly, no upstream changes found.
 *   - `failed`      — errored before completion; `error` column carries the
 *     message. `records_processed` may be non-zero (partial progress).
 */
declare const integrationRunStatusEnum: drizzle_orm_pg_core.PgEnum<["running", "success", "no_changes", "failed"]>;
/**
 * Operation applied per record. Mirrors `Change<T>.operation` from SYNC-2,
 * plus the recorder's own `'noop'` for changes that matched existing state.
 */
declare const integrationRunItemOperationEnum: drizzle_orm_pg_core.PgEnum<["created", "updated", "deleted", "noop"]>;
/**
 * Per-record status within a run. `skipped` captures loopback-detected echoes
 * of the local system's own writes (see `ILoopbackFingerprintStore` in the
 * epic), which record the external_id but intentionally do not touch local
 * state.
 */
declare const integrationRunItemStatusEnum: drizzle_orm_pg_core.PgEnum<["success", "failed", "skipped"]>;
/**
 * One cursor owner per (integration, adapter, domain, external_ref).
 *
 *   - `connection_id` — opaque id of the connected account/instance. E.g.
 *     the SFDC org id for polling strategies, the GitHub installation id
 *     for webhook strategies.
 *   - `adapter`        — short adapter label, e.g. `'salesforce'`, `'hubspot'`.
 *   - `domain`         — canonical entity domain this subscription tracks,
 *     e.g. `'opportunity'`, `'contact'`.
 *   - `external_ref`   — optional upstream scope (e.g. a filter id, a
 *     webhook subscription id). NULL when the subscription covers the
 *     entire domain.
 *
 * The cursor shape is opaque jsonb — strategies type it internally (poll:
 * `{ systemModstamp }`, cdc: `{ replayId }`, webhook: `{ ts }`). Overwritten
 * by `ICursorStore.put(id, cursor)`.
 */
declare const integrationSubscriptions: drizzle_orm_pg_core.PgTableWithColumns<{
    name: "integration_subscriptions";
    schema: undefined;
    columns: {
        id: drizzle_orm_pg_core.PgColumn<{
            name: "id";
            tableName: "integration_subscriptions";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        connectionId: drizzle_orm_pg_core.PgColumn<{
            name: "connection_id";
            tableName: "integration_subscriptions";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        adapter: drizzle_orm_pg_core.PgColumn<{
            name: "adapter";
            tableName: "integration_subscriptions";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        domain: drizzle_orm_pg_core.PgColumn<{
            name: "domain";
            tableName: "integration_subscriptions";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        externalRef: drizzle_orm_pg_core.PgColumn<{
            name: "external_ref";
            tableName: "integration_subscriptions";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        enabled: drizzle_orm_pg_core.PgColumn<{
            name: "enabled";
            tableName: "integration_subscriptions";
            dataType: "boolean";
            columnType: "PgBoolean";
            data: boolean;
            driverParam: boolean;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        config: drizzle_orm_pg_core.PgColumn<{
            name: "config";
            tableName: "integration_subscriptions";
            dataType: "json";
            columnType: "PgJsonb";
            data: Record<string, unknown>;
            driverParam: unknown;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: Record<string, unknown>;
        }>;
        cursor: drizzle_orm_pg_core.PgColumn<{
            name: "cursor";
            tableName: "integration_subscriptions";
            dataType: "json";
            columnType: "PgJsonb";
            data: unknown;
            driverParam: unknown;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: unknown;
        }>;
        lastIntegrationAt: drizzle_orm_pg_core.PgColumn<{
            name: "last_integration_at";
            tableName: "integration_subscriptions";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        tenantId: drizzle_orm_pg_core.PgColumn<{
            name: "tenant_id";
            tableName: "integration_subscriptions";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        createdAt: drizzle_orm_pg_core.PgColumn<{
            name: "created_at";
            tableName: "integration_subscriptions";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        updatedAt: drizzle_orm_pg_core.PgColumn<{
            name: "updated_at";
            tableName: "integration_subscriptions";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    };
    dialect: "pg";
}>;
type IntegrationSubscriptionRow = InferSelectModel<typeof integrationSubscriptions>;
/**
 * One row per invocation of `ExecuteIntegrationUseCase`. `started_at` is set when
 * the recorder opens the run; `completed_at`, `status`, `records_*`,
 * `cursor_after`, and `duration_ms` are filled on completion.
 *
 * `cursor_before` / `cursor_after` carry the opaque cursor snapshots so the
 * run log is fully self-describing — given a run id, an operator can reason
 * about exactly what window was scanned without cross-referencing another
 * table.
 */
declare const integrationRuns: drizzle_orm_pg_core.PgTableWithColumns<{
    name: "integration_runs";
    schema: undefined;
    columns: {
        id: drizzle_orm_pg_core.PgColumn<{
            name: "id";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        subscriptionId: drizzle_orm_pg_core.PgColumn<{
            name: "subscription_id";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        direction: drizzle_orm_pg_core.PgColumn<{
            name: "direction";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgEnumColumn";
            data: "inbound" | "outbound";
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: ["inbound", "outbound"];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        action: drizzle_orm_pg_core.PgColumn<{
            name: "action";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgEnumColumn";
            data: "poll" | "cdc" | "webhook" | "manual" | "writeback";
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: ["poll", "cdc", "webhook", "manual", "writeback"];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        status: drizzle_orm_pg_core.PgColumn<{
            name: "status";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgEnumColumn";
            data: "success" | "failed" | "no_changes" | "running";
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: ["running", "success", "no_changes", "failed"];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        recordsFound: drizzle_orm_pg_core.PgColumn<{
            name: "records_found";
            tableName: "integration_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        recordsProcessed: drizzle_orm_pg_core.PgColumn<{
            name: "records_processed";
            tableName: "integration_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        cursorBefore: drizzle_orm_pg_core.PgColumn<{
            name: "cursor_before";
            tableName: "integration_runs";
            dataType: "json";
            columnType: "PgJsonb";
            data: unknown;
            driverParam: unknown;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: unknown;
        }>;
        cursorAfter: drizzle_orm_pg_core.PgColumn<{
            name: "cursor_after";
            tableName: "integration_runs";
            dataType: "json";
            columnType: "PgJsonb";
            data: unknown;
            driverParam: unknown;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: unknown;
        }>;
        durationMs: drizzle_orm_pg_core.PgColumn<{
            name: "duration_ms";
            tableName: "integration_runs";
            dataType: "number";
            columnType: "PgInteger";
            data: number;
            driverParam: string | number;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        error: drizzle_orm_pg_core.PgColumn<{
            name: "error";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        startedAt: drizzle_orm_pg_core.PgColumn<{
            name: "started_at";
            tableName: "integration_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        completedAt: drizzle_orm_pg_core.PgColumn<{
            name: "completed_at";
            tableName: "integration_runs";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        tenantId: drizzle_orm_pg_core.PgColumn<{
            name: "tenant_id";
            tableName: "integration_runs";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    };
    dialect: "pg";
}>;
type IntegrationRunRow = InferSelectModel<typeof integrationRuns>;
/**
 * One row per upstream change processed within a run. Captures the canonical
 * decision the orchestrator made (`operation` + `status`), the structured
 * per-field diff (`changed_fields`, ADR-0003), and the local row id
 * (`local_id`) for drill-down joins.
 *
 * `changed_fields` is validated at the recorder layer via `FieldDiffSchema`
 * (SYNC-2) — the $type<FieldDiff> annotation here only documents the shape
 * for Drizzle consumers. The runtime enforcement is non-negotiable: downstream
 * drift-detection queries rely on the `{from, to}` shape per field.
 *
 * `title` is an optional human-readable label captured at write time (e.g.
 * `"Pinnacle opportunity"`) so run-log UIs don't need to re-hydrate the
 * canonical record.
 */
declare const integrationRunItems: drizzle_orm_pg_core.PgTableWithColumns<{
    name: "integration_run_items";
    schema: undefined;
    columns: {
        id: drizzle_orm_pg_core.PgColumn<{
            name: "id";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: true;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        integrationRunId: drizzle_orm_pg_core.PgColumn<{
            name: "integration_run_id";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgUUID";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        entityType: drizzle_orm_pg_core.PgColumn<{
            name: "entity_type";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        externalId: drizzle_orm_pg_core.PgColumn<{
            name: "external_id";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        localId: drizzle_orm_pg_core.PgColumn<{
            name: "local_id";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        operation: drizzle_orm_pg_core.PgColumn<{
            name: "operation";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgEnumColumn";
            data: "created" | "updated" | "deleted" | "noop";
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: ["created", "updated", "deleted", "noop"];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        status: drizzle_orm_pg_core.PgColumn<{
            name: "status";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgEnumColumn";
            data: "success" | "failed" | "skipped";
            driverParam: string;
            notNull: true;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: ["success", "failed", "skipped"];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        changedFields: drizzle_orm_pg_core.PgColumn<{
            name: "changed_fields";
            tableName: "integration_run_items";
            dataType: "json";
            columnType: "PgJsonb";
            data: Record<string, {
                from?: unknown;
                to?: unknown;
            }>;
            driverParam: unknown;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {
            $type: Record<string, {
                from?: unknown;
                to?: unknown;
            }>;
        }>;
        title: drizzle_orm_pg_core.PgColumn<{
            name: "title";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        error: drizzle_orm_pg_core.PgColumn<{
            name: "error";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        createdAt: drizzle_orm_pg_core.PgColumn<{
            name: "created_at";
            tableName: "integration_run_items";
            dataType: "date";
            columnType: "PgTimestamp";
            data: Date;
            driverParam: string;
            notNull: true;
            hasDefault: true;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: undefined;
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
        tenantId: drizzle_orm_pg_core.PgColumn<{
            name: "tenant_id";
            tableName: "integration_run_items";
            dataType: "string";
            columnType: "PgText";
            data: string;
            driverParam: string;
            notNull: false;
            hasDefault: false;
            isPrimaryKey: false;
            isAutoincrement: false;
            hasRuntimeDefault: false;
            enumValues: [string, ...string[]];
            baseColumn: never;
            identity: undefined;
            generated: undefined;
        }, {}, {}>;
    };
    dialect: "pg";
}>;
type IntegrationRunItemRow = InferSelectModel<typeof integrationRunItems>;

export { type IntegrationRunItemRow, type IntegrationRunRow, type IntegrationSubscriptionRow, integrationRunActionEnum, integrationRunDirectionEnum, integrationRunItemOperationEnum, integrationRunItemStatusEnum, integrationRunItems, integrationRunStatusEnum, integrationRuns, integrationSubscriptions };
