export type TranslationStatus = 'OK' | 'STALE' | 'FAILED'
export const STATUS_VALUES: readonly TranslationStatus[] = ['OK', 'STALE', 'FAILED']

export type LocaleDirection = 'ltr' | 'rtl'

export interface Language {
  code: string
  nameNative: string | null
  nameEnglish: string | null
  direction: LocaleDirection | null
  searchConfig: string | null
  isActive: boolean
  isDefault: boolean
  sortOrder: number
  createdAt: Date
  updatedAt: Date
}

export type NewLanguage = {
  code: string
  nameNative?: string | null
  nameEnglish?: string | null
  direction?: LocaleDirection | null
  searchConfig?: string | null
  isActive: boolean
  isDefault?: boolean
  sortOrder?: number
}

// Arg shapes for the read seam (spec §7)
export interface GetTranslationsArgs {
  entityType: string
  entityId: string
  locale: string
  fields?: readonly string[]
  fallbackToDefault?: boolean // default false
}

export interface GetTranslationsForArgs {
  entityType: string
  entityIds: readonly string[]
  locale: string
  fields?: readonly string[]
  fallbackToDefault?: boolean // default false
}

// Arg shapes for the write seam (spec §8)
export interface SetTranslationArgs {
  entityType: string
  entityId: string
  fieldKey: string
  locale: string
  value: string
  sourceHash?: string
  modelId?: string | null
  manualOverride?: boolean // default false
}

export interface MarkStaleArgs {
  entityType: string
  entityId: string
  fieldHashes: Record<string, string> // fieldKey -> newSourceHash computed by caller via hashSource
}

export interface MarkFailedArgs {
  entityType: string
  entityId: string
  fieldKey: string
  locale: string
  sourceHash?: string
  modelId?: string | null
}
