import type { Database } from '@adonisjs/lucid/database';
import type { MediaRecord } from '../media_record.js';
import { type MediaCollectionTotals, type MediaListOptions, type MediaListPage, type MediaOwnerPageOptions, type MediaStore, type MediaTotalsOptions } from '../media_store.js';
export interface LucidMediaStoreOptions {
    /** The Lucid connection name. Defaults to the `Database` default connection. */
    connectionName?: string;
    /** Table name. Default `media`. */
    table?: string;
    /**
     * Auto-create the `media` table on first use (default `true`). Set to `false` to
     * manage the schema explicitly via a migration calling {@link createMediaTables}.
     */
    autoCreateSchema?: boolean;
    /**
     * Read and write the `tenant_id` column (media's `tenancy` is on). Off by default: the column is
     * then never touched, so a table without it keeps working. With `autoCreateSchema` the column is
     * added when missing; without it, a missing column fails the first query with
     * {@link MediaTenancySchemaError} (run `node ace media:publish-migration tenancy`).
     */
    tenantColumn?: boolean;
}
/** Thrown when tenancy is on and the `media` table has no `tenant_id` column. */
export declare class MediaTenancySchemaError extends Error {
    readonly code = "E_MEDIA_TENANCY_SCHEMA";
    constructor(table: string);
}
/**
 * Lucid-backed {@link MediaStore}. Persists media records in a `media` table via `@adonisjs/lucid`'s
 * query builder (Knex), so it works across SQLite / Postgres / MySQL. JSON payloads
 * (`custom_properties`, `conversions`) are stored as TEXT and timestamps as epoch-ms integers, so the
 * schema is portable across engines.
 *
 * The `media` table is auto-created on first use (`autoCreateSchema`, default `true`) — the
 * ecosystem convention, same as `@adonis-agora/authz` and `@adonis-agora/durable`. An app that
 * prefers explicit control sets `autoCreateSchema: false` and publishes the migration via
 * `node ace configure @adonis-agora/media` (or calls {@link createMediaTables} from a migration).
 */
export declare class LucidMediaStore implements MediaStore {
    private readonly db;
    readonly tenantFiltering = true;
    private readonly table;
    private readonly connectionName;
    private readonly autoCreate;
    private readonly tenantColumn;
    private schemaReady;
    constructor(db: Database, options?: LucidMediaStoreOptions);
    private client;
    private query;
    /** Ensure the schema exists before the first operation, once per store instance. */
    private ready;
    private assertTenantColumn;
    /** Whether the table has the `tenant_id` column tenancy needs. */
    hasTenantColumn(): Promise<boolean>;
    /**
     * Create the `media` table (idempotent). Delegates to the standalone {@link createMediaTables}
     * so the auto-create path and a migration-based one run identical DDL.
     */
    ensureSchema(): Promise<void>;
    save(record: MediaRecord): Promise<MediaRecord>;
    find(id: string): Promise<MediaRecord | null>;
    listByOwner(ownerType: string, ownerId: string, collection?: string): Promise<MediaRecord[]>;
    listByOwnerPaged(ownerType: string, ownerId: string, options?: MediaOwnerPageOptions): Promise<MediaListPage>;
    list(options?: MediaListOptions & {
        collectionIn?: readonly string[];
    }): Promise<MediaListPage>;
    delete(id: string): Promise<void>;
    collectionTotals(options?: MediaTotalsOptions): Promise<MediaCollectionTotals[]>;
    listTenants(): Promise<string[]>;
    nextOrder(ownerType: string, ownerId: string, collection: string): Promise<number>;
}
//# sourceMappingURL=lucid.d.ts.map