/* eslint-disable @typescript-eslint/no-unused-vars */

/**
 * This is a list of all possible imports from Payload 2.x
 *
 * All of these should either resolve here
 *
 * OR
 *
 * Be documented in the migration guide and breaking changes doc
 */

import payload from 'payload'
import {
  CollectionPermission,
  FieldPermissions,
  GlobalPermission,
  IncomingAuthType,
  Permission,
  Permissions,
  User,
  VerifyConfig,
} from 'payload/auth'
import {
  Banner,
  Button,
  Check,
  Chevron,
  ErrorPill,
  Menu,
  MinimalTemplate,
  Pill,
  Popup,
  Search,
  ShimmerEffect,
  Tooltip,
  X,
} from 'payload/components'
import {
  Access,
  AccessArgs,
  AccessResult,
  AdminView,
  AdminViewComponent,
  AdminViewConfig,
  AdminViewProps,
  BaseLocalizationConfig,
  Config,
  EditView,
  EditViewConfig,
  EmailOptions,
  EmailTransport,
  EmailTransportOptions,
  Endpoint,
  EntityDescription,
  FieldTypes,
  GeneratePreviewURL,
  GraphQLExtension,
  InitOptions,
  LivePreviewConfig,
  Locale,
  LocalizationConfig,
  LocalizationConfigWithLabels,
  LocalizationConfigWithNoLabels,
  PayloadHandler,
  Plugin,
  SanitizedConfig,
  SanitizedLocalizationConfig,
  baseBlockFields,
  baseIDField,
  buildConfig,
  defaults,
  hasTransport,
  hasTransportOptions,
  sanitizeConfig,
  sanitizeFields,
} from 'payload/config'
import {
  BaseDatabaseAdapter,
  BeginTransaction,
  CommitTransaction,
  Connect,
  Count,
  CountArgs,
  Create,
  CreateArgs,
  CreateGlobal,
  CreateGlobalArgs,
  CreateGlobalVersion,
  CreateGlobalVersionArgs,
  CreateMigration,
  CreateVersion,
  CreateVersionArgs,
  DBIdentifierName,
  DeleteMany,
  DeleteManyArgs,
  DeleteOne,
  DeleteOneArgs,
  DeleteVersions,
  DeleteVersionsArgs,
  Destroy,
  EntityPolicies,
  Find,
  FindArgs,
  FindGlobal,
  FindGlobalArgs,
  FindGlobalVersions,
  FindGlobalVersionsArgs,
  FindOne,
  FindOneArgs,
  FindVersions,
  FindVersionsArgs,
  Init,
  Migration,
  MigrationData,
  PaginatedDocs,
  PathToQuery,
  QueryDrafts,
  QueryDraftsArgs,
  RollbackTransaction,
  Transaction,
  TypeWithVersion,
  UpdateGlobal,
  UpdateGlobalArgs,
  UpdateGlobalVersion,
  UpdateGlobalVersionArgs,
  UpdateOne,
  UpdateOneArgs,
  UpdateVersion,
  UpdateVersionArgs,
  combineQueries,
  createDatabaseAdapter,
  createMigration,
  flattenWhereToOperators,
  getLocalizedPaths,
  getMigrations,
  migrate,
  migrateDown,
  migrateRefresh,
  migrateReset,
  migrateStatus,
  migrationTemplate,
  migrationsCollection,
  readMigrationFiles,
  validateQueryPaths,
  validateSearchParam,
} from 'payload/database'
import {
  APIError,
  AuthenticationError,
  DuplicateCollection,
  DuplicateGlobal,
  ErrorDeletingFile,
  FileUploadError,
  Forbidden,
  InvalidConfiguration,
  InvalidFieldName,
  InvalidFieldRelationship,
  LockedAuth,
  MissingCollectionLabel,
  MissingFieldInputOptions,
  MissingFieldType,
  MissingFile,
  NotFound,
  QueryError,
  ValidationError,
} from 'payload/errors'
import { GraphQL, buildPaginatedListType } from 'payload/graphql'
import {
  AccessArgs as AccessArgsType,
  Access as AccessType,
  AllOperations,
  ArrayField,
  AuthOperations,
  BeforeDuplicate,
  Block,
  BlockField,
  CellComponentProps,
  CheckboxField,
  CodeField,
  CollapsibleField,
  Collection,
  CollectionAfterChangeHook,
  CollectionAfterDeleteHook,
  CollectionAfterForgotPasswordHook,
  CollectionAfterLoginHook,
  CollectionAfterOperationHook,
  CollectionAfterReadHook,
  CollectionBeforeChangeHook,
  CollectionBeforeDeleteHook,
  CollectionBeforeLoginHook,
  CollectionBeforeOperationHook,
  CollectionBeforeReadHook,
  CollectionBeforeValidateHook,
  CollectionConfig,
  Condition,
  CreateFormData,
  CustomPublishButtonProps,
  CustomPublishButtonType,
  CustomSaveButtonProps,
  CustomSaveDraftButtonProps,
  Data,
  DateField,
  Document,
  EmailField,
  Field,
  FieldAccess,
  FieldAffectingData,
  FieldBase,
  FieldHook,
  FieldHookArgs,
  FieldPresentationalOnly,
  FieldWithMany,
  FieldWithMaxDepth,
  FieldWithPath,
  FieldWithRichTextRequiredEditor,
  FieldWithSubFields,
  Fields,
  FileData,
  FilterOptions,
  FilterOptionsProps,
  FormField,
  FormFieldsContext,
  GlobalAfterChangeHook,
  GlobalAfterReadHook,
  GlobalBeforeChangeHook,
  GlobalBeforeReadHook,
  GlobalBeforeValidateHook,
  GlobalConfig,
  GroupField,
  HookName,
  ImageSize,
  IncomingUploadType,
  JSONField,
  Labels,
  NamedTab,
  NonPresentationalField,
  NumberField,
  Operation,
  Operator,
  Option,
  OptionObject,
  PayloadRequest,
  PointField,
  PolymorphicRelationshipField,
  RadioField,
  RelationshipField,
  RelationshipValue,
  RichTextAdapter,
  RichTextFieldProps,
  RichTextFieldRequiredEditor,
  RichTextField as RichTextFieldType,
  RowAdmin,
  RowField,
  RowLabel,
  SanitizedCollectionConfig,
  SanitizedGlobalConfig,
  SelectField,
  SingleRelationshipField,
  Tab,
  TabAsField,
  TabsAdmin,
  TabsField,
  TextField,
  TextareaField,
  TypeWithID,
  UIField,
  UnnamedTab,
  UploadField,
  Validate,
  ValidateOptions,
  ValueWithRelation,
  VersionOperations,
  Where,
  WhereField,
  docHasTimestamps,
  fieldAffectsData,
  fieldHasMaxDepth,
  fieldHasSubFields,
  fieldIsArrayType,
  fieldIsBlockType,
  fieldIsGroupType,
  fieldIsLocalized,
  fieldIsPresentationalOnly,
  fieldSupportsMany,
  optionIsObject,
  optionIsValue,
  optionsAreObjects,
  tabHasName,
  validOperators,
  valueIsValueWithRelation,
} from 'payload/types'
import {
  afterReadPromise,
  afterReadTraverseFields,
  combineMerge,
  configToJSONSchema,
  createArrayFromCommaDelineated,
  deepCopyObject,
  deepMerge,
  entityToJSONSchema,
  extractTranslations,
  fieldSchemaToJSON,
  fieldsToJSONSchema,
  flattenTopLevelFields,
  formatLabels,
  formatNames,
  getCollectionIDFieldTypes,
  getIDType,
  getTranslation,
  i18nInit,
  isValidID,
  toWords,
  withMergedProps,
  withNullableJSONSchemaType,
} from 'payload/utilities'
import {
  buildVersionCollectionFields,
  buildVersionGlobalFields,
  deleteCollectionVersions,
  enforceMaxVersions,
  getLatestCollectionVersion,
  getLatestGlobalVersion,
  saveVersion,
} from 'payload/versions'

/**
 * Plugins
 */

import {
  Args,
  MigrateDownArgs,
  MigrateUpArgs,
  MongooseAdapter,
  mongooseAdapter,
} from '@payloadcms/db-mongodb'
import {
  MigrateDownArgs as MigrateDownArgsPg,
  MigrateUpArgs as MigrateUpArgsPg,
  postgresAdapter,
} from '@payloadcms/db-postgres'
import { handleMessage, mergeData, ready, subscribe, unsubscribe } from '@payloadcms/live-preview'
import { useLivePreview } from '@payloadcms/live-preview-react'
import { createKey, getStorageClient, payloadCloud } from '@payloadcms/plugin-cloud'
import { cloudStorage } from '@payloadcms/plugin-cloud-storage'
import { fields, getPaymentTotal } from '@payloadcms/plugin-form-builder'
import {
  BeforeEmail,
  BlockConfig,
  CountryField,
  Email,
  FieldConfig,
  FieldValues,
  FieldsConfig,
  Form,
  CheckboxField as FormBuilderCheckboxField,
  EmailField as FormBuilderEmailField,
  SelectField as FormBuilderSelectField,
  TextField as FormBuilderTextField,
  FormFieldBlock,
  FormSubmission,
  FormattedEmail,
  HandlePayment,
  MessageField,
  PaymentField,
  PaymentFieldConfig,
  PluginConfig,
  PriceCondition,
  Redirect,
  SelectFieldOption,
  StateField,
  SubmissionValue,
  TextAreaField,
  isValidBlockConfig,
} from '@payloadcms/plugin-form-builder/types'
import nestedDocs from '@payloadcms/plugin-nested-docs'
import { createBreadcrumbsField, createParentField } from '@payloadcms/plugin-nested-docs/fields'
import {
  Breadcrumb,
  GenerateLabel,
  GenerateURL,
  PluginConfig as NestedDocsPluginConfig,
} from '@payloadcms/plugin-nested-docs/types'
import redirects from '@payloadcms/plugin-redirects'
import { PluginConfig as RedirectsPluginConfig } from '@payloadcms/plugin-redirects/types'

// Skip plugin-sentry

import search from '@payloadcms/plugin-search'
import {
  BeforeSync,
  DocToSync,
  SearchConfig,
  SyncWithSearch,
} from '@payloadcms/plugin-search/types'
import seo from '@payloadcms/plugin-seo'
import {
  GenerateDescription,
  GenerateImage,
  GenerateTitle,
  Meta,
  PluginConfig as SeoPluginConfig,
  GenerateURL as seoGenerateURL,
} from '@payloadcms/plugin-seo/types'
import stripePlugin from '@payloadcms/plugin-stripe'
import {
  FieldSyncConfig,
  SanitizedStripeConfig,
  StripeConfig,
  StripeProxy,
  StripeWebhookHandler,
  StripeWebhookHandlers,
  SyncConfig,
} from '@payloadcms/plugin-stripe/types'
import {
  $createAutoLinkNode,
  $createBlockNode,
  $createLinkNode,
  $createRelationshipNode,
  $createUploadNode,
  $isAutoLinkNode,
  $isBlockNode,
  $isLinkNode,
  $isRelationshipNode,
  $isUploadNode,
  AdapterProps,
  AlignFeature,
  AutoLinkNode,
  BlockFields,
  BlockNode,
  BlockQuoteFeature,
  BlocksFeature,
  BlocksFeatureProps,
  BoldTextFeature,
  CAN_USE_DOM,
  CheckListFeature,
  DETAIL_TYPE_TO_DETAIL,
  DOUBLE_LINE_BREAK,
  ELEMENT_FORMAT_TO_TYPE,
  ELEMENT_TYPE_TO_FORMAT,
  ENABLE_SLASH_MENU_COMMAND,
  EditorConfig,
  EditorConfigProvider,
  Feature,
  FeatureProvider,
  FeatureProviderMap,
  FloatingToolbarSection,
  FloatingToolbarSectionEntry,
  FormatSectionWithEntries,
  HTMLConverter,
  HTMLConverterFeature,
  HTMLConverterFeatureProps,
  HeadingFeature,
  IS_ALL_FORMATTING,
  IndentFeature,
  InlineCodeTextFeature,
  ItalicTextFeature,
  LTR_REGEX,
  LexicalBlock,
  LexicalEditorProps,
  LexicalPluginToLexicalFeature,
  LexicalRichTextAdapter,
  LinebreakHTMLConverter,
  LinkFeature,
  LinkFeatureProps,
  LinkFields,
  LinkNode,
  NON_BREAKING_SPACE,
  NodeFormat,
  NodeValidation,
  OrderedListFeature,
  ParagraphFeature,
  ParagraphHTMLConverter,
  Point,
  PopulationPromise,
  RTL_REGEX,
  RawUploadPayload,
  Rect,
  RelationshipData,
  RelationshipFeature,
  RelationshipNode,
  ResolvedFeature,
  ResolvedFeatureMap,
  SanitizedEditorConfig,
  SanitizedFeatures,
  SerializedAutoLinkNode,
  SerializedBlockNode,
  SerializedLinkNode,
  SerializedRelationshipNode,
  SerializedUploadNode,
  SlashMenuGroup,
  SlashMenuOption,
  SlateBlockquoteConverter,
  SlateHeadingConverter,
  SlateIndentConverter,
  SlateLinkConverter,
  SlateListItemConverter,
  SlateNode,
  SlateNodeConverter,
  SlateOrderedListConverter,
  SlateRelationshipConverter,
  SlateToLexicalFeature,
  SlateUnknownConverter,
  SlateUnorderedListConverter,
  SlateUploadConverter,
  StrikethroughTextFeature,
  SubscriptTextFeature,
  SuperscriptTextFeature,
  TEXT_MODE_TO_TYPE,
  TEXT_TYPE_TO_FORMAT,
  TEXT_TYPE_TO_MODE,
  TOGGLE_LINK_COMMAND,
  TestRecorderFeature,
  TextDropdownSectionWithEntries,
  TextHTMLConverter,
  TreeViewFeature,
  UnderlineTextFeature,
  UnorderedListFeature,
  UploadData,
  UploadFeature,
  UploadFeatureProps,
  UploadNode,
  addSwipeDownListener,
  addSwipeLeftListener,
  addSwipeRightListener,
  addSwipeUpListener,
  cloneDeep,
  consolidateHTMLConverters,
  convertLexicalNodesToHTML,
  convertLexicalToHTML,
  convertSlateNodesToLexical,
  convertSlateToLexical,
  createBlockNode,
  defaultEditorConfig,
  defaultEditorFeatures,
  defaultHTMLConverters,
  defaultRichTextValue,
  defaultSanitizedEditorConfig,
  defaultSlateConverters,
  getDOMRangeRect,
  getEnabledNodes,
  getSelectedNode,
  invariant,
  isHTMLElement,
  isPoint,
  joinClasses,
  lexicalEditor,
  lexicalHTML,
  loadFeatures,
  sanitizeEditorConfig,
  sanitizeFeatures,
  sanitizeUrl,
  setFloatingElemPosition,
  setFloatingElemPositionForLinkEditor,
  sortFeaturesForOptimalLoading,
  useEditorConfigContext,
  validateUrl,
} from '@payloadcms/richtext-lexical'
import {
  RichTextCell,
  RichTextField,
  ToolbarButton,
  ToolbarDropdown,
  defaultEditorLexicalConfig,
} from '@payloadcms/richtext-lexical/components'
import {
  AdapterArguments,
  ElementButton,
  ElementNode,
  FieldProps,
  LeafButton,
  RichTextCustomElement,
  RichTextCustomLeaf,
  RichTextElement,
  RichTextLeaf,
  TextNode,
  nodeIsTextNode,
  slateEditor,
  toggleElement,
} from '@payloadcms/richtext-slate'
