import { describe, expect, it } from 'vitest'
import * as content from './index.js'

describe('@platform-modules/content public barrel', () => {
  it('exports the full read+write contract + types + errors + schema', () => {
    for (const name of [
      'list',
      'getBySlug',
      'getById',
      'put',
      'publish',
      'schedule',
      'promoteScheduled',
      'unpublish',
      'trash',
      'restore',
      'remove',
      'setVisibility',
      'contentVisibilityMigrationSql',
      'createContentSearchProvider',
      'contentSearchMigrationSql',
      'normalizeContentInput',
      'assertCanModify',
      'assertCanPublish',
      'ContentValidationError',
      'ContentNotFoundError',
      'ContentConflictError',
      'ContentAuthzError',
      'contentEntries',
      'contentSchema',
      'readFlatContentEntries',
      'assertContentTransactionIdentity',
      'ContentStoreContractError',
      'isContentStoreContractError',
      'ContentDefinitionError',
      'isContentDefinitionError',
      'normalizeContentTypeDefinition',
      'defineContentType',
      'resolveContentTypes',
      'resolveContentType',
      'createContentType',
      'normalizeContentStatusDefinition',
      'defineContentStatus',
      'resolveContentStatuses',
      'resolveContentStatus',
      'createContentStatus',
      'previewContentTypeChange',
      'applyContentTypeChange',
      'previewContentStatusChange',
      'applyContentStatusChange',
      'previewContentCodeReconciliation',
      'applyContentCodeReconciliation',
      'restoreContentBackup',
      'contentBackupDestinationHash',
      'authorizeContentAction',
      'resolveRequiredContentCapabilities',
      'ContentAuthorizationError',
      'validateContentParent',
      'preparePermanentContentDelete',
      'ContentHierarchyError',
      'createContentEntry',
      'updateContentEntry',
      'transitionContent',
      'trashContent',
      'restoreContent',
      'changeContentPassword',
      'verifyContentPassword',
      'readProtectedContent',
      'applyPermanentContentDelete',
      'listContentRevisions',
      'getContentRevision',
      'restoreContentRevision',
      'createContentAutosave',
      'getContentAutosave',
      'restoreContentAutosave',
      'ContentLifecycleError',
      'createContentPostgresSearchAdapter',
      'buildContentQueryPredicate',
      'decodeContentListQuery',
      'listPage',
      'countByStatus',
      'count',
      'ContentQueryError',
      'compileContentRoutes',
      'resolveContentRoute',
      'resolveContentTemplate',
      'ContentRouteError',
      'generateContentSchema',
      'createContentHeadlessRuntime',
      'ContentHeadlessError',
      'parseContentImport',
      'createDbContentImportJournal',
      'planContentImport',
      'startContentImport',
      'resumeContentImport',
      'publishContentImport',
      'rollbackContentImport',
      'planPublishedContentImportReverse',
      'reversePublishedContentImport',
      'ContentImportError',
      'isContentImportError',
      'exportContent',
      'ContentExportError',
      'isContentExportError',
    ]) {
      expect(content, `missing export: ${name}`).toHaveProperty(name)
    }
  })

  it('does NOT re-export the feed projection from the core barrel (it is a ./feed subpath)', () => {
    expect(content).not.toHaveProperty('toFeed')
  })
})
