export type { StorageAdapter, StorageConfig } from './types.js';
export { TierDetectionError, detectAndAssertTier, probeServiceHealth } from './tier-detection.js';
export type { ServiceCheck, TierHealthReport } from './tier-detection.js';
export { createStorageAdapter, registerStorageAdapter } from './factory.js';
export { PostgresAdapter } from './adapters/postgres.js';
export { PgliteAdapter } from './adapters/pglite.js';
export { registerStorageCommand } from './cli.js';
export {
  getMigrationOrder,
  topoSort,
  runMigrateTier,
  checkTargetPreconditions,
  normaliseSourceRow,
  PostgresMigrationTarget,
  DrizzleMigrationSource,
  SKIP_TABLES,
  MIGRATION_ORDER,
  MigrationPreconditionError,
} from './migrate-tier.js';
export type {
  MigrationSource,
  MigrationTarget,
  MigrateTierOptions,
  MigrateTierResult,
  TableMigrationResult,
} from './migrate-tier.js';

import { registerStorageAdapter } from './factory.js';
import { PostgresAdapter } from './adapters/postgres.js';
import { PgliteAdapter } from './adapters/pglite.js';
import type { StorageConfig } from './types.js';

registerStorageAdapter('postgres', (config: StorageConfig) => {
  return new PostgresAdapter(config as Extract<StorageConfig, { type: 'postgres' }>);
});

registerStorageAdapter('pglite', (config: StorageConfig) => {
  return new PgliteAdapter(config as Extract<StorageConfig, { type: 'pglite' }>);
});
