import type { PlzContext, SyncContext } from './context';
/** Mapeo de un registro externo a datos de contacto en Plazbot */
export interface SyncMapping {
    /** Como encontrar el contacto existente */
    match: {
        phone?: string;
        email?: string;
        id?: string;
    };
    /** Variables a setear en el contacto */
    variables?: Record<string, string>;
    /** Operaciones sobre el contacto */
    contact?: {
        name?: string;
        tags?: string[];
        stage?: string;
        segmentation?: string;
    };
}
/** Estadisticas de una ejecucion de sync */
export interface SyncStats {
    total: number;
    created: number;
    updated: number;
    skipped: number;
    errors: number;
    duration: number;
}
/** Configuracion completa de un sync */
export interface SyncConfig<T = unknown> {
    /** Nombre unico del sync (slug) */
    name: string;
    /** Referencia del sync — describe que datos sincroniza */
    reference: string;
    /** Nombre del sistema origen (HubSpot, Salesforce, etc.) */
    source: string;
    /** Expresion cron para ejecucion automatica */
    schedule: string;
    /** Obtener registros del sistema externo */
    fetch(plz: SyncContext): Promise<T[]>;
    /** Mapear un registro externo a datos de contacto Plazbot. Retornar null para skip. */
    map(item: T): SyncMapping | null;
    /** Callback al completar la sincronizacion */
    onComplete?(stats: SyncStats, plz: PlzContext): Promise<void>;
}
/** Sync definido y listo para desplegar */
export interface SyncDefinition<T = unknown> {
    __type: 'sync';
    config: SyncConfig<T>;
}
