import { I18nContentSchema } from './schema.js';
export { i18nContentSchema, languages, translationValue } from './schema.js';
export { i18nContentMigrationSql, pushSchema } from './migrate.js';
import { Querier, TransactionalDatabase } from '@platform-modules/db';
import 'drizzle-orm/pg-core';

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;

declare function assertFieldKey(key: string): void;
declare function assertEntityType(t: string): void;
declare function assertEntityId(id: string): void;

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;
}

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>;

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>;

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>>>;

export { type GetTranslationsArgs, type GetTranslationsForArgs, I18nContentError, I18nContentSchema, InvalidEntityIdError, InvalidFieldKeyError, type Language, type LocaleDirection, type MarkFailedArgs, type MarkStaleArgs, type NewLanguage, STATUS_VALUES, type SetTranslationArgs, type TranslationStatus, UnknownLocaleError, assertEntityId, assertEntityType, assertFieldKey, getDefaultLocale, getTranslations, getTranslationsFor, isI18nContentError, isLocaleActive, listLanguages, markFailed, markStale, setTranslation, upsertLanguage };
