import { BaseWorkflow, Typings } from '../workflow';
import { z } from '@botpress/sdk';
import { ZodType } from '@bpinternal/zui';
import { WellKnownTags } from '../../constants';
export type Item = z.infer<typeof Item>;
declare const Item: z.ZodObject<{
    file: z.ZodString;
    name: z.ZodString;
    hash: z.ZodString;
    size: z.ZodNumber;
}, "strip", {
    name: string;
    size: number;
    hash: string;
    file: string;
}, {
    name: string;
    size: number;
    hash: string;
    file: string;
}>;
export type SyncInput = z.infer<typeof SyncInput>;
export declare const SyncInput: z.ZodObject<{
    dsId: z.ZodString;
    kbName: z.ZodString;
    kbId: z.ZodString;
    force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", {
    kbId: string;
    kbName: string;
    dsId: string;
    force: boolean;
}, {
    kbId: string;
    kbName: string;
    dsId: string;
    force?: boolean | undefined;
}>;
export type SyncOutput = z.infer<typeof SyncOutput>;
export declare const SyncOutput: z.ZodObject<{
    processed: z.ZodDefault<z.ZodNumber>;
    added: z.ZodDefault<z.ZodArray<z.ZodObject<{
        file: z.ZodString;
        name: z.ZodString;
        hash: z.ZodString;
        size: z.ZodNumber;
    }, "strip", {
        name: string;
        size: number;
        hash: string;
        file: string;
    }, {
        name: string;
        size: number;
        hash: string;
        file: string;
    }>, "many">>;
    updated: z.ZodDefault<z.ZodArray<z.ZodObject<{
        file: z.ZodString;
        name: z.ZodString;
        hash: z.ZodString;
        size: z.ZodNumber;
    }, "strip", {
        name: string;
        size: number;
        hash: string;
        file: string;
    }, {
        name: string;
        size: number;
        hash: string;
        file: string;
    }>, "many">>;
    deleted: z.ZodDefault<z.ZodArray<z.ZodObject<{
        file: z.ZodString;
        name: z.ZodString;
        hash: z.ZodString;
        size: z.ZodNumber;
    }, "strip", {
        name: string;
        size: number;
        hash: string;
        file: string;
    }, {
        name: string;
        size: number;
        hash: string;
        file: string;
    }>, "many">>;
    errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
}, "strip", {
    processed: number;
    added: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[];
    updated: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[];
    deleted: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[];
    errors: string[];
}, {
    processed?: number | undefined;
    added?: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[] | undefined;
    updated?: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[] | undefined;
    deleted?: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[] | undefined;
    errors?: string[] | undefined;
}>;
export declare const createSyncWorkflow: <TState extends ZodType = ZodType>(props: {
    type: string;
    state: TState;
    handler: (props: Typings.HandlerProps<`data_source_sync_${string}`, typeof SyncInput, typeof SyncOutput, TState>) => Promise<z.infer<typeof SyncOutput>>;
}) => BaseWorkflow<`data_source_sync_${string}`, z.ZodObject<{
    dsId: z.ZodString;
    kbName: z.ZodString;
    kbId: z.ZodString;
    force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
}, "strip", {
    kbId: string;
    kbName: string;
    dsId: string;
    force: boolean;
}, {
    kbId: string;
    kbName: string;
    dsId: string;
    force?: boolean | undefined;
}>, z.ZodObject<{
    processed: z.ZodDefault<z.ZodNumber>;
    added: z.ZodDefault<z.ZodArray<z.ZodObject<{
        file: z.ZodString;
        name: z.ZodString;
        hash: z.ZodString;
        size: z.ZodNumber;
    }, "strip", {
        name: string;
        size: number;
        hash: string;
        file: string;
    }, {
        name: string;
        size: number;
        hash: string;
        file: string;
    }>, "many">>;
    updated: z.ZodDefault<z.ZodArray<z.ZodObject<{
        file: z.ZodString;
        name: z.ZodString;
        hash: z.ZodString;
        size: z.ZodNumber;
    }, "strip", {
        name: string;
        size: number;
        hash: string;
        file: string;
    }, {
        name: string;
        size: number;
        hash: string;
        file: string;
    }>, "many">>;
    deleted: z.ZodDefault<z.ZodArray<z.ZodObject<{
        file: z.ZodString;
        name: z.ZodString;
        hash: z.ZodString;
        size: z.ZodNumber;
    }, "strip", {
        name: string;
        size: number;
        hash: string;
        file: string;
    }, {
        name: string;
        size: number;
        hash: string;
        file: string;
    }>, "many">>;
    errors: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
}, "strip", {
    processed: number;
    added: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[];
    updated: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[];
    deleted: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[];
    errors: string[];
}, {
    processed?: number | undefined;
    added?: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[] | undefined;
    updated?: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[] | undefined;
    deleted?: {
        name: string;
        size: number;
        hash: string;
        file: string;
    }[] | undefined;
    errors?: string[] | undefined;
}>, TState, Record<string, import("../../types").ZuiType>, Record<string, import("../../types").ZuiType>>;
/**
 * The base set of well-known tags every ingested file carries, identifying
 * the knowledge base and the source it came from. Source implementations merge
 * these with any user-supplied `extraFileTags`.
 */
export type BaseFileTags = {
    [WellKnownTags.knowledge.KNOWLEDGE]: 'knowledge-base';
    [WellKnownTags.knowledge.KNOWLEDGE_BASE_ID]: string;
    [WellKnownTags.knowledge.KNOWLEDGE_BASE_NAME]: string;
    [WellKnownTags.knowledge.KNOWLEDGE_SOURCE_ID]: string;
    [WellKnownTags.knowledge.KNOWLEDGE_SOURCE_TYPE]: string;
};
/**
 * Arbitrary extra file tags. Either a static record applied to every file, or
 * a function invoked per upload (so callers can derive tags from runtime
 * context, e.g. the current draft/published slot). Reserved well-known tag
 * keys (`source`, `kbId`, `kbName`, `dsId`, `dsType`) are stripped so custom
 * tags can never clobber the identity tags that scope KB search.
 */
export type ExtraFileTags = Record<string, string> | (() => Record<string, string>);
export declare abstract class DataSource {
    readonly id: string;
    readonly type: string;
    protected readonly extraTags: ExtraFileTags | undefined;
    /**
     * The workflow that handles synchronization for this data source
     * Each data source type provides its own sync workflow implementation
     */
    abstract readonly syncWorkflow: BaseWorkflow<any>;
    /**
     * Get the serializable configuration for this data source.
     * Used for computing config hashes to detect changes.
     */
    abstract getConfig(): Record<string, unknown>;
    constructor(id: string, type: string, options?: {
        tags?: ExtraFileTags | undefined;
    });
    /**
     * Extra tags merged into every uploaded file. Defaults to the `tags` option
     * passed to the factory (resolving a function form per call). Subclasses may
     * override for fully dynamic behavior.
     *
     * @example
     * // via factory option (no subclass needed)
     * DataSource.Website.fromUrls(urls, { tags: { slot: 'draft' } })
     * @example
     * // dynamic, derived from runtime context
     * DataSource.Website.fromUrls(urls, { tags: () => ({ slot: currentSlot() }) })
     */
    protected extraFileTags(): Record<string, string>;
    /**
     * The stable ownership tags for this source. Use these when listing existing
     * files, so cleanup still sees files written under older custom tag values.
     */
    protected baseFileTags(input: z.infer<typeof SyncInput>): BaseFileTags;
    /**
     * The full tag object applied to each uploaded file: the well-known identity
     * tags plus any user-supplied extra tags. Reserved keys in the extra tags are
     * dropped so they can't override KB/source identity. Source implementations
     * call this instead of assembling tags inline.
     */
    protected fileTags(input: z.infer<typeof SyncInput>): BaseFileTags & Record<string, string>;
    protected fileTagsMatch(file: {
        tags?: Record<string, string> | undefined;
    } | null | undefined, expected: Record<string, string>): boolean;
    protected fileTagsPatch(file: {
        tags?: Record<string, string> | undefined;
    } | null | undefined, expected: Record<string, string>): Record<string, string | null>;
}
export {};
//# sourceMappingURL=source-base.d.ts.map