import { I18nContentSchema, i18nContentSchema, languages, translationValue } from "./schema.js";
import { i18nContentMigrationSql, pushSchema } from "./migrate.js";
import { Querier, TransactionalDatabase } from "@platform-modules/db";
//#region src/errors.d.ts
declare class I18nContentError extends Error {
  readonly code: string;
  readonly name: string;
  readonly _tag: "I18nContentError";
  constructor(code: string, message: string);
}
declare class UnknownLocaleError extends I18nContentError {
  readonly locale: string;
  readonly name = "UnknownLocaleError";
  constructor(locale: string);
}
declare class InvalidFieldKeyError extends I18nContentError {
  readonly key: string;
  readonly name = "InvalidFieldKeyError";
  constructor(key: string);
}
declare class InvalidEntityIdError extends I18nContentError {
  readonly entityId: string;
  readonly name = "InvalidEntityIdError";
  constructor(entityId: string);
}
declare function isI18nContentError(e: unknown): e is I18nContentError;
//#endregion
//#region src/validate.d.ts
declare function assertFieldKey(key: string): void;
declare function assertEntityType(t: string): void;
declare function assertEntityId(id: string): void;
//#endregion
//#region src/model.d.ts
type TranslationStatus = 'OK' | 'STALE' | 'FAILED';
declare const STATUS_VALUES: readonly TranslationStatus[];
type LocaleDirection = 'ltr' | 'rtl';
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;
}
type NewLanguage = {
  code: string;
  nameNative?: string | null;
  nameEnglish?: string | null;
  direction?: LocaleDirection | null;
  searchConfig?: string | null;
  isActive: boolean;
  isDefault?: boolean;
  sortOrder?: number;
};
interface GetTranslationsArgs {
  entityType: string;
  entityId: string;
  locale: string;
  fields?: readonly string[];
  fallbackToDefault?: boolean;
}
interface GetTranslationsForArgs {
  entityType: string;
  entityIds: readonly string[];
  locale: string;
  fields?: readonly string[];
  fallbackToDefault?: boolean;
}
interface SetTranslationArgs {
  entityType: string;
  entityId: string;
  fieldKey: string;
  locale: string;
  value: string;
  sourceHash?: string;
  modelId?: string | null;
  manualOverride?: boolean;
}
interface MarkStaleArgs {
  entityType: string;
  entityId: string;
  fieldHashes: Record<string, string>;
}
interface MarkFailedArgs {
  entityType: string;
  entityId: string;
  fieldKey: string;
  locale: string;
  sourceHash?: string;
  modelId?: string | null;
}
//#endregion
//#region src/languages.d.ts
declare function listLanguages(q: Querier<I18nContentSchema>, opts?: {
  activeOnly?: boolean;
}): Promise<Language[]>;
declare function getDefaultLocale(q: Querier<I18nContentSchema>): Promise<string>;
declare function isLocaleActive(q: Querier<I18nContentSchema>, code: string): Promise<boolean>;
declare function upsertLanguage(q: TransactionalDatabase<I18nContentSchema>, lang: NewLanguage): Promise<void>;
//#endregion
//#region src/store.d.ts
declare function setTranslation(q: Querier<I18nContentSchema>, args: SetTranslationArgs): Promise<void>;
declare function markFailed(q: Querier<I18nContentSchema>, args: MarkFailedArgs): Promise<void>;
declare function markStale(q: Querier<I18nContentSchema>, args: MarkStaleArgs): Promise<void>;
//#endregion
//#region src/query.d.ts
declare function getTranslations(q: Querier<I18nContentSchema>, args: GetTranslationsArgs): Promise<Record<string, string>>;
declare function getTranslationsFor(q: Querier<I18nContentSchema>, args: GetTranslationsForArgs): Promise<Map<string, Record<string, string>>>;
//#endregion
export { GetTranslationsArgs, GetTranslationsForArgs, I18nContentError, I18nContentSchema, InvalidEntityIdError, InvalidFieldKeyError, Language, LocaleDirection, MarkFailedArgs, MarkStaleArgs, NewLanguage, STATUS_VALUES, SetTranslationArgs, TranslationStatus, UnknownLocaleError, assertEntityId, assertEntityType, assertFieldKey, getDefaultLocale, getTranslations, getTranslationsFor, i18nContentMigrationSql, i18nContentSchema, isI18nContentError, isLocaleActive, languages, listLanguages, markFailed, markStale, pushSchema, setTranslation, translationValue, upsertLanguage };