import { AbstractCursor } from './cursor/abstract_cursor';
import { AggregationCursor } from './cursor/aggregation_cursor';
import { FindCursor } from './cursor/find_cursor';
import { ListIndexesCursor } from './operations/indexes';
import { ListCollectionsCursor } from './operations/list_collections';
import { PromiseProvider } from './promise_provider';
import { Admin } from './admin';
import { MongoClient } from './mongo_client';
import { Db } from './db';
import { Collection } from './collection';
import { Logger } from './logger';
import { GridFSBucket } from './gridfs';
import { CancellationToken } from './mongo_types';

export {
  Binary,
  Code,
  DBRef,
  Double,
  Int32,
  Long,
  MinKey,
  MaxKey,
  ObjectId,
  Timestamp,
  Decimal128,
  BSONRegExp,
  BSONSymbol,
  Map
} from './bson';

import { ObjectId } from 'bson';
/**
 * @public
 * @deprecated Please use `ObjectId`
 */
export const ObjectID = ObjectId;

export {
  MongoError,
  MongoServerError,
  MongoDriverError,
  MongoAPIError,
  MongoCompatibilityError,
  MongoInvalidArgumentError,
  MongoMissingCredentialsError,
  MongoMissingDependencyError,
  MongoNetworkError,
  MongoNetworkTimeoutError,
  MongoSystemError,
  MongoServerSelectionError,
  MongoParseError,
  MongoWriteConcernError,
  MongoRuntimeError,
  MongoChangeStreamError,
  MongoGridFSStreamError,
  MongoGridFSChunkError,
  MongoDecompressionError,
  MongoBatchReExecutionError,
  MongoCursorExhaustedError,
  MongoCursorInUseError,
  MongoNotConnectedError,
  MongoExpiredSessionError,
  MongoTransactionError,
  MongoKerberosError,
  MongoServerClosedError,
  MongoTopologyClosedError
} from './error';
export { MongoBulkWriteError, BulkWriteOptions, AnyBulkWriteOperation } from './bulk/common';
export {
  // Utils
  PromiseProvider as Promise,
  // Actual driver classes exported
  Admin,
  MongoClient,
  Db,
  Collection,
  Logger,
  AbstractCursor,
  AggregationCursor,
  FindCursor,
  ListIndexesCursor,
  ListCollectionsCursor,
  GridFSBucket,
  CancellationToken
};

// enums
export { ProfilingLevel } from './operations/set_profiling_level';
export { ServerType, TopologyType } from './sdam/common';
export { LoggerLevel } from './logger';
export { AutoEncryptionLoggerLevel } from './deps';
export { BatchType } from './bulk/common';
export { AuthMechanism } from './cmap/auth/defaultAuthProviders';
export { CURSOR_FLAGS } from './cursor/abstract_cursor';
export { Compressor } from './cmap/wire_protocol/compression';
export { ReturnDocument } from './operations/find_and_modify';
export { ExplainVerbosity } from './explain';
export { ReadConcernLevel } from './read_concern';
export { ReadPreferenceMode } from './read_preference';
export { ServerApiVersion } from './mongo_client';
export { BSONType } from './mongo_types';

// Helper classes
export { WriteConcern } from './write_concern';
export { ReadConcern } from './read_concern';
export { ReadPreference } from './read_preference';

// events
export {
  CommandStartedEvent,
  CommandSucceededEvent,
  CommandFailedEvent
} from './cmap/command_monitoring_events';
export {
  ConnectionCheckOutFailedEvent,
  ConnectionCheckOutStartedEvent,
  ConnectionCheckedInEvent,
  ConnectionCheckedOutEvent,
  ConnectionClosedEvent,
  ConnectionCreatedEvent,
  ConnectionPoolClearedEvent,
  ConnectionPoolClosedEvent,
  ConnectionPoolCreatedEvent,
  ConnectionPoolMonitoringEvent,
  ConnectionReadyEvent
} from './cmap/connection_pool_events';
export {
  ServerHeartbeatStartedEvent,
  ServerHeartbeatSucceededEvent,
  ServerHeartbeatFailedEvent,
  ServerClosedEvent,
  ServerDescriptionChangedEvent,
  ServerOpeningEvent,
  TopologyClosedEvent,
  TopologyDescriptionChangedEvent,
  TopologyOpeningEvent
} from './sdam/events';
export { SrvPollingEvent } from './sdam/srv_polling';

// type only exports below, these are removed from emitted JS
export type { AdminPrivate } from './admin';
export type { Document, BSONSerializeOptions } from './bson';
export type {
  InsertOneModel,
  ReplaceOneModel,
  UpdateOneModel,
  UpdateManyModel,
  DeleteOneModel,
  DeleteManyModel,
  BulkResult,
  BulkWriteResult,
  WriteError,
  WriteConcernError,
  BulkWriteOperationError
} from './bulk/common';
export type {
  ChangeStream,
  ChangeStreamDocument,
  UpdateDescription,
  ChangeStreamEvents,
  ChangeStreamOptions,
  ChangeStreamCursor,
  ResumeToken,
  PipeOptions,
  ChangeStreamCursorOptions,
  OperationTime,
  ResumeOptions
} from './change_stream';
export type {
  MongoCredentials,
  AuthMechanismProperties,
  MongoCredentialsOptions
} from './cmap/auth/mongo_credentials';
export type {
  WriteProtocolMessageType,
  Query,
  GetMore,
  Msg,
  KillCursor,
  OpGetMoreOptions,
  OpQueryOptions
} from './cmap/commands';
export type { Stream, LEGAL_TLS_SOCKET_OPTIONS, LEGAL_TCP_SOCKET_OPTIONS } from './cmap/connect';
export type {
  Connection,
  ConnectionOptions,
  DestroyOptions,
  CommandOptions,
  QueryOptions,
  GetMoreOptions,
  ConnectionEvents
} from './cmap/connection';
export type { ConnectionPoolMetrics } from './cmap/metrics';
export type {
  CloseOptions,
  ConnectionPoolOptions,
  WaitQueueMember,
  WithConnectionCallback,
  ConnectionPool,
  ConnectionPoolEvents
} from './cmap/connection_pool';
export type {
  OperationDescription,
  MessageStream,
  MessageStreamOptions
} from './cmap/message_stream';
export type { StreamDescription, StreamDescriptionOptions } from './cmap/stream_description';
export type { CompressorName } from './cmap/wire_protocol/compression';
export type { CollectionPrivate, CollectionOptions, ModifyResult } from './collection';
export type { AggregationCursorOptions } from './cursor/aggregation_cursor';
export type {
  CursorCloseOptions,
  CursorStreamOptions,
  AbstractCursorOptions,
  AbstractCursorEvents,
  CursorFlag
} from './cursor/abstract_cursor';
export type { DbPrivate, DbOptions } from './db';
export type { AutoEncryptionOptions, AutoEncrypter } from './deps';
export type { AnyError, ErrorDescription, MongoNetworkErrorOptions } from './error';
export type { Explain, ExplainOptions, ExplainVerbosityLike } from './explain';
export type {
  GridFSBucketReadStream,
  GridFSBucketReadStreamOptions,
  GridFSBucketReadStreamOptionsWithRevision,
  GridFSBucketReadStreamPrivate,
  GridFSFile
} from './gridfs/download';
export type { GridFSBucketOptions, GridFSBucketPrivate, GridFSBucketEvents } from './gridfs/index';
export type {
  GridFSBucketWriteStreamOptions,
  GridFSBucketWriteStream,
  GridFSChunk
} from './gridfs/upload';
export type { LoggerOptions, LoggerFunction } from './logger';
export type {
  MongoClientEvents,
  MongoClientPrivate,
  MongoClientOptions,
  WithSessionCallback,
  PkFactory,
  Auth,
  DriverInfo,
  MongoOptions,
  ServerApi,
  SupportedNodeConnectionOptions,
  SupportedTLSConnectionOptions,
  SupportedTLSSocketOptions,
  SupportedSocketOptions
} from './mongo_client';
export type {
  TypedEventEmitter,
  EventsDescription,
  CommonEvents,
  GenericListener
} from './mongo_types';
export type { AddUserOptions, RoleSpecification } from './operations/add_user';
export type {
  AggregateOptions,
  AggregateOperation,
  DB_AGGREGATE_COLLECTION
} from './operations/aggregate';
export type { MONGO_CLIENT_EVENTS } from './operations/connect';
export type {
  CommandOperationOptions,
  OperationParent,
  CommandOperation,
  CollationOptions
} from './operations/command';
export type { IndexInformationOptions } from './operations/common_functions';
export type { CountOptions } from './operations/count';
export type { CountDocumentsOptions } from './operations/count_documents';
export type {
  CreateCollectionOptions,
  TimeSeriesCollectionOptions
} from './operations/create_collection';
export type { DeleteOptions, DeleteResult, DeleteStatement } from './operations/delete';
export type { DistinctOptions } from './operations/distinct';
export type { DropCollectionOptions, DropDatabaseOptions } from './operations/drop';
export type { EstimatedDocumentCountOptions } from './operations/estimated_document_count';
export type { EvalOptions } from './operations/eval';
export type { FindOptions } from './operations/find';
export type { Sort, SortDirection, SortDirectionForCmd, SortForCmd } from './sort';
export type {
  FindOneAndDeleteOptions,
  FindOneAndReplaceOptions,
  FindOneAndUpdateOptions
} from './operations/find_and_modify';
export type {
  IndexSpecification,
  CreateIndexesOptions,
  IndexDescription,
  DropIndexesOptions,
  ListIndexesOptions,
  IndexDirection
} from './operations/indexes';
export type { InsertOneResult, InsertOneOptions, InsertManyResult } from './operations/insert';
export type { ListCollectionsOptions, CollectionInfo } from './operations/list_collections';
export type { ListDatabasesResult, ListDatabasesOptions } from './operations/list_databases';
export type {
  MapFunction,
  ReduceFunction,
  MapReduceOptions,
  FinalizeFunction
} from './operations/map_reduce';
export type { Hint, OperationOptions, AbstractOperation } from './operations/operation';
export type { ProfilingLevelOptions } from './operations/profiling_level';
export type { RemoveUserOptions } from './operations/remove_user';
export type { RenameOptions } from './operations/rename';
export type { RunCommandOptions } from './operations/run_command';
export type { SetProfilingLevelOptions } from './operations/set_profiling_level';
export type {
  CollStatsOptions,
  DbStatsOptions,
  CollStats,
  WiredTigerData
} from './operations/stats';
export type {
  UpdateResult,
  UpdateOptions,
  ReplaceOptions,
  UpdateStatement
} from './operations/update';
export type { ValidateCollectionOptions } from './operations/validate_collection';
export type { ReadConcernLike } from './read_concern';
export type {
  ReadPreferenceLike,
  ReadPreferenceOptions,
  ReadPreferenceLikeOptions,
  ReadPreferenceFromOptions,
  HedgeOptions
} from './read_preference';
export type { ClusterTime, TimerQueue } from './sdam/common';
export type {
  Monitor,
  MonitorEvents,
  MonitorPrivate,
  MonitorOptions,
  RTTPinger,
  RTTPingerOptions
} from './sdam/monitor';
export type { Server, ServerEvents, ServerPrivate, ServerOptions } from './sdam/server';
export type {
  TopologyVersion,
  TagSet,
  ServerDescription,
  ServerDescriptionOptions
} from './sdam/server_description';
export type { ServerSelector } from './sdam/server_selection';
export type { SrvPoller, SrvPollerEvents, SrvPollerOptions } from './sdam/srv_polling';
export type {
  Topology,
  TopologyEvents,
  TopologyPrivate,
  ServerSelectionRequest,
  TopologyOptions,
  ServerCapabilities,
  ConnectOptions,
  SelectServerOptions,
  ServerSelectionCallback
} from './sdam/topology';
export type { TopologyDescription, TopologyDescriptionOptions } from './sdam/topology_description';
export type {
  ClientSession,
  ClientSessionEvents,
  ClientSessionOptions,
  EndSessionOptions,
  ServerSessionPool,
  ServerSession,
  ServerSessionId,
  WithTransactionCallback
} from './sessions';
export type { TransactionOptions, Transaction, TxnState } from './transactions';
export type {
  Callback,
  ClientMetadata,
  ClientMetadataOptions,
  MongoDBNamespace,
  InterruptibleAsyncInterval,
  BufferPool,
  HostAddress,
  EventEmitterWithState
} from './utils';
export type { W, WriteConcernOptions, WriteConcernSettings } from './write_concern';
export type { ExecutionResult } from './operations/execute_operation';
export type { InternalAbstractCursorOptions } from './cursor/abstract_cursor';
export type {
  BulkOperationBase,
  BulkOperationPrivate,
  FindOperators,
  Batch,
  WriteConcernErrorData
} from './bulk/common';
export type { OrderedBulkOperation } from './bulk/ordered';
export type { UnorderedBulkOperation } from './bulk/unordered';
export type { Encrypter, EncrypterOptions } from './encrypter';
export type {
  EnhancedOmit,
  WithId,
  OptionalId,
  WithoutId,
  UpdateFilter,
  Filter,
  Projection,
  InferIdType,
  ProjectionOperators,
  Flatten,
  SchemaMember,
  Condition,
  RootFilterOperators,
  AlternativeType,
  FilterOperators,
  BSONTypeAlias,
  BitwiseFilter,
  RegExpOrString,
  OnlyFieldsOfType,
  NumericType,
  IntegerType,
  MatchKeysAndValues,
  SetFields,
  PullOperator,
  PushOperator,
  PullAllOperator,
  AcceptedFields,
  NotAcceptedFields,
  AddToSetOperators,
  ArrayOperator,
  FilterOperations,
  KeysOfAType,
  KeysOfOtherType,
  IsAny,
  OneOrMore
} from './mongo_types';
export type { serialize, deserialize } from './bson';
