import { I18nContentSchema } from "@platform-modules/i18n-content";
import { Querier } from "@platform-modules/db";
import { IdempotencyStore, JobRegistry } from "@platform-modules/jobs";
//#region src/model.d.ts
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>;
}
//#endregion
//#region src/worker.d.ts
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;
//#endregion
export { idempotencyKey as a, FieldOutcome as c, LocaleResult as d, SourceTextProvider as f, TranslationWorker as h, createTranslationWorker as i, GetEntityTranslationStatusArgs as l, TranslateEntityArgs as m, TRANSLATION_SWEEP_JOB as n, EntityTranslationResult as o, StaleUnit as p, TranslationWorkerEnv as r, EntityTranslationStatus as s, CreateTranslationWorkerDeps as t, GetEntityTranslationStatusForArgs as u };