import { FlatfileListener } from '@flatfile/listener';
import { Flatfile } from '@flatfile/api';

/**
 * Plugin config options.
 *
 * @property {string} on - field key to match on
 * @property {string} keep - "first" | "last"
 * @property {function} custom - custom dedupe function
 * @property {boolean} debug - show helpful messages useful for debugging (usage intended for development)
 */
interface PluginOptions {
    readonly on?: string;
    readonly keep?: 'first' | 'last';
    readonly custom?: (records: Flatfile.RecordsWithLinks, uniques: Set<unknown>) => Array<string>;
    readonly debug?: boolean;
}

/**
 * Dedupe plugin for Flatfile.
 *
 * @param jobOperation - job operation to match on
 * @param opts - plugin config options
 */
declare const dedupePlugin: (jobOperation: string, opts: PluginOptions) => (listener: FlatfileListener) => void;

export { dedupePlugin };
