import type { RequestBuilder, ListResponse } from "../request-builder";
import type { RequestOptions } from "../base-client";
/** Import adapter metadata returned by listAdapters. */
export interface ImportAdapter {
    key: string;
    display_name: string;
    domain: string;
    required_bundle: string;
    commit_strategy: "atomic" | "chunked";
    required_fields: string[];
    optional_fields: string[];
}
/** Import job record. */
export interface Import {
    id: string;
    adapter_key: string;
    status: "pending" | "parsing" | "validated" | "validation_failed" | "committing" | "completed" | "commit_failed" | "cancelled";
    source_type: "csv" | "url" | "api_batch";
    source_ref: string | null;
    column_mapping: Record<string, string> | null;
    metadata: Record<string, unknown>;
    row_count: number;
    created_count: number;
    updated_count: number;
    failed_count: number;
    error_report: Array<{
        row: number;
        errors: string[];
    }> | null;
    commit_strategy: "atomic" | "chunked";
    workspace_id: string;
    inserted_at: string;
    updated_at: string;
}
/** Per-row outcome for chunked imports. */
export interface ImportRow {
    id: string;
    import_id: string;
    workspace_id: string;
    row_index: number;
    status: "pending" | "committed" | "updated" | "failed";
    error_messages: string[] | null;
    created_resource_id: string | null;
    created_resource_type: string | null;
    inserted_at: string;
    updated_at: string;
}
export declare function createImportsNamespace(rb: RequestBuilder): {
    /**
     * List available import adapter types for the current application.
     * @returns Array of adapter metadata objects
     * @example
     * const adapters = await admin.imports.listAdapters();
     * // [{ key: "clinical:goal", display_name: "Clinical Goals", ... }]
     */
    listAdapters: (options?: RequestOptions) => Promise<ImportAdapter[]>;
    /**
     * Submit a JSON batch import.
     * @param params - adapter key, workspace_id, and rows array
     * @returns Import job with id and initial status
     * @example
     * const result = await admin.imports.batch({
     *   adapter: "clinical:goal",
     *   workspace_id: "ws_123",
     *   rows: [{ contact_id: "...", title: "Increase water intake", goal_type: "hydration" }]
     * });
     */
    batch: (params: {
        adapter: string;
        workspace_id: string;
        rows: Record<string, unknown>[];
        metadata?: Record<string, unknown>;
    }, options?: RequestOptions) => Promise<{
        import_id: string;
        status: string;
    }>;
    /**
     * Upload a CSV file for import.
     * @param file - CSV file (File or Blob)
     * @param params - adapter key and workspace_id
     * @returns Import job with id and initial status
     * @example
     * const result = await admin.imports.upload(csvFile, {
     *   adapter: "clinical:patient_bundle",
     *   workspace_id: "ws_123"
     * });
     */
    upload: (file: File | Blob, params: {
        adapter: string;
        workspace_id: string;
        column_mapping?: Record<string, string>;
        metadata?: Record<string, unknown>;
    }, options?: RequestOptions) => Promise<{
        data: {
            import_id: string;
            status: string;
        };
    }>;
    /**
     * List imports for a workspace with optional filters.
     * @param params - workspace_id required, adapter and status optional
     * @returns List of imports with pagination metadata
     * @example
     * const { data: imports, meta } = await admin.imports.list({ workspace_id: "ws_123" });
     * console.log(`${meta.count} total imports`);
     */
    list: (params: {
        workspace_id: string;
        adapter?: string;
        status?: string;
        offset?: number;
        limit?: number;
    }, options?: RequestOptions) => Promise<ListResponse<Import>>;
    /**
     * Get a single import by ID.
     * @param id - Import UUID
     * @returns Full import record including error_report
     * @example
     * const imp = await admin.imports.get("uuid-here");
     */
    get: (id: string, options?: RequestOptions) => Promise<Import>;
    /**
     * Get per-row outcomes for a chunked import.
     * @param importId - Import UUID
     * @param params - Pagination options
     * @returns List of row outcomes with pagination metadata
     * @example
     * const { data: rows, meta } = await admin.imports.rows("uuid-here", { offset: 0, limit: 50 });
     * console.log(`${meta.count} total rows`);
     */
    rows: (importId: string, params?: {
        offset?: number;
        limit?: number;
    }, options?: RequestOptions) => Promise<ListResponse<ImportRow>>;
    /**
     * Confirm a validated import for commit.
     * @param id - Import UUID
     * @param params - workspace_id for authorization
     * @returns Updated import with status "committing"
     * @example
     * await admin.imports.confirm("uuid-here", { workspace_id: "ws_123" });
     */
    confirm: (id: string, params: {
        workspace_id: string;
    }, options?: RequestOptions) => Promise<{
        import_id: string;
        status: string;
    }>;
    /**
     * Cancel a validated import.
     * @param id - Import UUID
     * @param params - workspace_id for authorization
     * @returns Updated import with status "cancelled"
     * @example
     * await admin.imports.cancel("uuid-here", { workspace_id: "ws_123" });
     */
    cancel: (id: string, params: {
        workspace_id: string;
    }, options?: RequestOptions) => Promise<{
        import_id: string;
        status: string;
    }>;
};
//# sourceMappingURL=imports.d.ts.map