import { InArgs } from "@libsql/client";
/**
 * Error types for database operations
 */
export type DatabaseErrorCode = "NOT_FOUND" | "PERMISSION_DENIED" | "CONFLICT" | "SYNTAX_ERROR" | "CONSTRAINT_VIOLATION" | "INTERNAL_ERROR" | "NETWORK_ERROR" | "TRANSACTION_ERROR";
/**
 * Abstract base error class for database operations
 */
export declare abstract class DatabaseError extends Error {
    readonly code: DatabaseErrorCode;
    readonly cause?: Error | undefined;
    constructor(code: DatabaseErrorCode, message: string, cause?: Error | undefined);
}
/**
 * Error class for when a database is not found
 */
export declare class DatabaseNotFoundError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * Error class for permission denied errors
 */
export declare class DatabasePermissionDeniedError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * Error class for SQL syntax errors
 */
export declare class DatabaseSyntaxError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * Error class for constraint violations
 */
export declare class DatabaseConstraintError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * Error class for internal errors
 */
export declare class DatabaseInternalError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * Error class for network errors
 */
export declare class DatabaseNetworkError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * Error class for transaction errors
 */
export declare class DatabaseTransactionError extends DatabaseError {
    constructor(message: string, cause?: Error);
}
/**
 * SQL execution result
 */
export interface DatabaseResult {
    columns: string[];
    rows: unknown[][];
    rowsAffected: number;
    lastInsertId?: number;
}
/**
 * SQL statement with optional parameters
 */
export interface DatabaseStatement {
    sql: string;
    params?: InArgs;
}
/**
 * Batch execution results
 */
export interface DatabaseBatchResult {
    results: DatabaseResult[];
}
/**
 * Database table information
 */
export interface DatabaseTableInfo {
    name: string;
    columns: DatabaseColumnInfo[];
}
/**
 * Column information
 */
export interface DatabaseColumnInfo {
    name: string;
    type: string;
    notNull: boolean;
    defaultValue?: unknown;
    primaryKey: boolean;
}
/**
 * Database information
 */
export interface DatabaseInfo {
    name: string;
    size: number;
    lastModified: Date;
    tables: DatabaseTableInfo[];
}
/**
 * Result of ensuring a database exists
 */
export interface EnsureDatabaseResult {
    exists: boolean;
    created: boolean;
}
/**
 * Result of deleting a database
 */
export interface DeleteDatabaseResult {
    deleted: boolean;
}
/**
 * Interface for a database
 */
export interface Database {
    /**
     * Execute a single SQL statement
     */
    execute(sql: string, params?: InArgs): Promise<DatabaseResult>;
    /**
     * Execute multiple SQL statements in a transaction
     */
    batch(statements: DatabaseStatement[]): Promise<DatabaseBatchResult>;
    /**
     * Execute multiple SQL statements as a script (without transaction semantics)
     */
    executeMultiple(sql: string): Promise<DatabaseBatchResult>;
    /**
     * Run SQL migration statements with foreign keys disabled
     */
    migrate(sql: string): Promise<DatabaseBatchResult>;
    /**
     * Get information about the database
     */
    getInfo(): Promise<DatabaseInfo>;
    /**
     * Close the database connection
     */
    close(): void;
}
/**
 * Interface for database storage
 */
export interface DatabaseStorage {
    /**
     * Get a database by name
     */
    getDatabase(name: string): Database;
    /**
     * List all databases
     * @param options Options for listing databases
     * @returns Promise with array of database names and optional next cursor for pagination
     */
    listDatabases(options?: {
        limit?: number;
        cursor?: string;
    }): Promise<{
        databases: {
            name: string;
            createdAt: Date;
        }[];
        nextCursor?: string;
    }>;
    /**
     * Ensure a database exists
     * @param name Database name
     * @returns Promise resolving to result with exists and created flags
     */
    ensureDatabase(name: string): Promise<EnsureDatabaseResult>;
    /**
     * Delete a database
     * @param name Database name
     * @returns Promise resolving to result with deleted flag
     */
    deleteDatabase(name: string): Promise<DeleteDatabaseResult>;
    /**
     * Check if a database has been ensured
     */
    hasEnsuredDatabase(name: string): boolean;
}
/**
 * Provider configuration kinds
 */
export type DatabaseStorageKind = "filesystem" | "cloud";
/**
 * Base storage configuration
 */
export interface BaseDatabaseStorageOptions {
    /**
     * Storage kind - if not provided, will be determined from environment
     */
    kind?: DatabaseStorageKind;
    /**
     * Optional project name. By default, the GENSX_PROJECT environment variable will be used then the projectName from the gensx.yaml file.
     */
    project?: string;
    /**
     * Optional environment name. By default, the GENSX_ENV environment variable will be used then the currently selected environment in the CLI (e.g. `gensx env select`).
     */
    environment?: string;
}
/**
 * Filesystem storage configuration
 */
export interface FileSystemDatabaseStorageOptions extends BaseDatabaseStorageOptions {
    kind?: "filesystem";
    /**
     * Root directory for storing database files
     */
    rootDir?: string;
}
/**
 * Cloud storage configuration
 */
export interface CloudDatabaseStorageOptions extends BaseDatabaseStorageOptions {
    kind?: "cloud";
}
/**
 * Union type for database storage configuration
 */
export type DatabaseStorageOptions = FileSystemDatabaseStorageOptions | CloudDatabaseStorageOptions;
//# sourceMappingURL=types.d.ts.map