import { Querier } from '@platform-modules/db';
import { I18nContentSchema } from '@platform-modules/i18n-content';
import { IdempotencyStore, JobRegistry } from '@platform-modules/jobs';

interface SourceTextProvider {
    getSourceText(args: {
        entityType: string;
        entityId: string;
        fields: readonly string[];
    }): Promise<{
        locale: string;
        fields: Record<string, string>;
    }>;
}
type EntityTranslationStatus = 'missing' | 'failed' | 'partial' | 'stale' | 'complete';
interface TranslateEntityArgs {
    entityType: string;
    entityId: string;
    fields: readonly string[];
    targetLocales: readonly string[];
    source: SourceTextProvider;
    modelId?: string;
    skipUnchanged?: boolean;
}
type FieldOutcome = {
    fieldKey: string;
    outcome: 'OK' | 'SKIPPED' | 'FAILED';
};
type LocaleResult = {
    locale: string;
    fields: FieldOutcome[];
};
type EntityTranslationResult = {
    results: LocaleResult[];
};
interface GetEntityTranslationStatusArgs {
    entityType: string;
    entityId: string;
    locale: string;
    fields: readonly string[];
}
interface GetEntityTranslationStatusForArgs {
    entityType: string;
    entityIds: readonly string[];
    locale: string;
    fields: readonly string[];
}
interface StaleUnit {
    entityType: string;
    entityId: string;
    fieldKey: string;
    locale: string;
    sourceHash: string;
}
interface TranslationWorker {
    runSweep(args?: {
        limitPerLocale?: number;
    }): Promise<void>;
}

declare const TRANSLATION_SWEEP_JOB = "i18n.translation.sweep";
type TranslationWorkerEnv = {
    q: Querier<I18nContentSchema>;
    source: SourceTextProvider;
    idempotencyStore: IdempotencyStore;
    selectStale: (q: Querier<I18nContentSchema>, args: {
        locale: string;
        limit: number;
    }) => Promise<readonly StaleUnit[]>;
};
type CreateTranslationWorkerDeps = TranslationWorkerEnv & {
    registry: JobRegistry<TranslationWorkerEnv>;
};
declare function idempotencyKey(unit: StaleUnit): string;
declare function createTranslationWorker(deps: CreateTranslationWorkerDeps): TranslationWorker;

export { type CreateTranslationWorkerDeps as C, type EntityTranslationResult as E, type FieldOutcome as F, type GetEntityTranslationStatusArgs as G, type LocaleResult as L, type SourceTextProvider as S, type TranslateEntityArgs as T, type EntityTranslationStatus as a, type GetEntityTranslationStatusForArgs as b, type StaleUnit as c, TRANSLATION_SWEEP_JOB as d, type TranslationWorker as e, type TranslationWorkerEnv as f, createTranslationWorker as g, idempotencyKey as i };
