import type {
  Constructor,
  IMigrationGenerator,
  IMigrationRunner,
  IMigrator,
  IMigratorStorage,
  MaybePromise,
  Migration,
  MigrationInfo,
  MigrationRow,
  MigratorEvent,
} from '../typings.js';
import type { Transaction } from '../connections/Connection.js';
import type { Configuration, MigrationsOptions } from './Configuration.js';
import type { EntityManagerType, IDatabaseDriver } from '../drivers/IDatabaseDriver.js';
interface RunnableMigration {
  name: string;
  path?: string;
  up: () => MaybePromise<void>;
  down: () => MaybePromise<void>;
}
type MigrateOptions = {
  from?: string | number;
  to?: string | number;
  migrations?: string[];
  transaction?: Transaction;
};
export declare abstract class AbstractMigrator<D extends IDatabaseDriver> implements IMigrator {
  #private;
  protected readonly em: D[typeof EntityManagerType];
  protected runner: IMigrationRunner;
  protected storage: IMigratorStorage;
  protected generator: IMigrationGenerator;
  protected readonly driver: D;
  protected readonly config: Configuration;
  protected readonly options: MigrationsOptions;
  protected absolutePath: string;
  protected initialized: boolean;
  constructor(em: D[typeof EntityManagerType]);
  protected abstract createRunner(): IMigrationRunner;
  protected abstract createStorage(): IMigratorStorage;
  protected abstract getDefaultGenerator(): IMigrationGenerator;
  abstract create(
    path?: string,
    blank?: boolean,
    initial?: boolean,
    name?: string,
  ): Promise<{
    fileName: string;
    code: string;
    diff: {
      up: string[];
      down: string[];
    };
  }>;
  abstract checkSchema(): Promise<boolean>;
  abstract createInitial(
    path?: string,
    name?: string,
    blank?: boolean,
  ): Promise<{
    fileName: string;
    code: string;
    diff: {
      up: string[];
      down: string[];
    };
  }>;
  /**
   * @inheritDoc
   */
  on(eventName: MigratorEvent, listener: (event: MigrationInfo) => MaybePromise<void>): this;
  /**
   * @inheritDoc
   */
  off(eventName: MigratorEvent, listener: (event: MigrationInfo) => MaybePromise<void>): this;
  /**
   * @inheritDoc
   */
  getExecuted(): Promise<MigrationRow[]>;
  /**
   * @inheritDoc
   */
  getPending(): Promise<MigrationInfo[]>;
  /**
   * @inheritDoc
   */
  up(options?: string | string[] | MigrateOptions): Promise<MigrationInfo[]>;
  /**
   * @inheritDoc
   */
  down(options?: string | string[] | Omit<MigrateOptions, 'from'>): Promise<MigrationInfo[]>;
  abstract getStorage(): IMigratorStorage;
  protected init(): Promise<void>;
  protected initServices(): void;
  protected resolve(params: { name: string; path: string }): RunnableMigration;
  protected initialize(MigrationClass: Constructor<Migration>, name: string): RunnableMigration;
  /**
   * Checks if `src` folder exists, it so, tries to adjust the migrations and seeders paths automatically to use it.
   * If there is a `dist` or `build` folder, it will be used for the JS variant (`path` option), while the `src` folder will be
   * used for the TS variant (`pathTs` option).
   *
   * If the default folder exists (e.g. `/migrations`), the config will respect that, so this auto-detection should not
   * break existing projects, only help with the new ones.
   */
  private detectSourceFolder;
  private registerDefaultListeners;
  private emit;
  private discoverMigrations;
  private executeMigrations;
  private filterUp;
  private filterDown;
  private getMigrationFilename;
  private prefix;
  protected runMigrations(
    method: 'up' | 'down',
    options?: string | string[] | MigrateOptions,
  ): Promise<MigrationInfo[]>;
  private runInTransaction;
}
export {};
