import { EntityManagerType } from '@mikro-orm/core';
import { AbstractSqlDriver } from '@mikro-orm/sql';
import { PostgreSqlConnection } from './PostgreSqlConnection.js';
import { PostgreSqlPlatform } from './PostgreSqlPlatform.js';
import { PostgreSqlMikroORM } from './PostgreSqlMikroORM.js';
import { PostgreSqlEntityManager } from './PostgreSqlEntityManager.js';
/** Database driver for PostgreSQL. */
export class PostgreSqlDriver extends AbstractSqlDriver {
  [EntityManagerType];
  constructor(config) {
    super(config, new PostgreSqlPlatform(), PostgreSqlConnection, ['kysely', 'pg']);
  }
  createEntityManager(useContext) {
    const EntityManagerClass = this.config.get('entityManager', PostgreSqlEntityManager);
    return new EntityManagerClass(this.config, this, this.metadata, useContext);
  }
  /** @inheritDoc */
  getORMClass() {
    return PostgreSqlMikroORM;
  }
}
