export interface SourceTextProvider {
  getSourceText(args: {
    entityType: string
    entityId: string
    fields: readonly string[]
  }): Promise<{ locale: string; fields: Record<string, string> }>
}

export type EntityTranslationStatus = 'missing' | 'failed' | 'partial' | 'stale' | 'complete'

export interface TranslateEntityArgs {
  entityType: string
  entityId: string
  fields: readonly string[]
  targetLocales: readonly string[]
  source: SourceTextProvider
  modelId?: string
  skipUnchanged?: boolean
}

export type FieldOutcome = { fieldKey: string; outcome: 'OK' | 'SKIPPED' | 'FAILED' }

export type LocaleResult = { locale: string; fields: FieldOutcome[] }

export type EntityTranslationResult = { results: LocaleResult[] }

export interface GetEntityTranslationStatusArgs {
  entityType: string
  entityId: string
  locale: string
  fields: readonly string[]
}

export interface GetEntityTranslationStatusForArgs {
  entityType: string
  entityIds: readonly string[]
  locale: string
  fields: readonly string[]
}

export interface StaleUnit {
  entityType: string
  entityId: string
  fieldKey: string
  locale: string
  sourceHash: string
}

export interface TranslationWorker {
  runSweep(args?: { limitPerLocale?: number }): Promise<void>
}
