// This file is auto-generated by alef — DO NOT EDIT.
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
// To regenerate: alef generate
// To verify freshness: alef verify --exit-code
// Issues & docs: https://github.com/kreuzberg-dev/alef

import { describe, expect, it } from 'vitest';import { extractFile, registerDocumentExtractor, registerEmbeddingBackend, registerOcrBackend, registerPostProcessor, registerRenderer, registerValidator, unregisterDocumentExtractor, unregisterEmbeddingBackend, unregisterPostProcessor, unregisterRenderer, unregisterValidator, WasmAccelerationConfig, WasmChunkingConfig, WasmContentFilterConfig, WasmEmailConfig, WasmEmbeddingConfig, WasmHierarchyConfig, WasmHtmlOutputConfig, WasmImageExtractionConfig, WasmImagePreprocessingConfig, WasmKeywordConfig, WasmLanguageDetectionConfig, WasmLayoutDetectionConfig, WasmLlmConfig, WasmOcrConfig, WasmOcrElementConfig, WasmOcrPipelineConfig, WasmOcrPipelineStage, WasmOcrQualityThresholds, WasmPageConfig, WasmPdfConfig, WasmPostProcessorConfig, WasmRakeParams, WasmSecurityLimits, WasmStructuredExtractionConfig, WasmTesseractConfig, WasmTokenReductionOptions, WasmTreeSitterConfig, WasmTreeSitterProcessConfig, WasmYakeParams } from '@kreuzberg/wasm';
function _alefE2eText(value: unknown): string {
  return value == null ? "" : String(value);
}

function _alefE2eItemTexts(item: unknown): string[] {
  if (item == null || typeof item !== "object") {
    return [_alefE2eText(item)];
  }
  const record = item as Record<string, unknown>;
  const itemsText = Array.isArray(record.items) ? record.items.map(_alefE2eText).join(" ") : "";
  return [_alefE2eText(item), _alefE2eText(record.kind), _alefE2eText(record.name), _alefE2eText(record.source), _alefE2eText(record.alias), _alefE2eText(record.text), _alefE2eText(record.signature), itemsText];
}

function _alefE2eFormatMetadataDisplay(fm: unknown): string {
  if (fm == null) return "";
  if (typeof fm !== "object") return String(fm);
  const record = fm as Record<string, unknown>;
  const formatType = record.format_type;

  // FormatMetadata is a tagged union: { format_type: 'image', image: { format: 'PNG', ... }, ... }
  // Extract the display string based on the variant type
  if (formatType === "image" && typeof record.image === "object") {
    const imageData = record.image as Record<string, unknown>;
    if (typeof imageData.format === "string") return imageData.format;
  }

  // Fallback: return format_type variant name
  if (typeof record.format_type === "string") return record.format_type;
  return "";
}


describe('plugin_api', () => {  it('register_document_extractor_trait_bridge: register_document_extractor: trait bridge', () => {    class _TestStub_register_document_extractor_trait_bridge {
  name(): string { return "test-extractor"; }
  async extract_bytes(_p0?: any, _p1?: any, _p2?: any): Promise<string> { return "{}"; }
  async extract_file(_p0?: any, _p1?: any, _p2?: any): Promise<string> { return "{}"; }
  supported_mime_types(): string { return []; }
  priority(): number { return 1; }
  can_handle(_p0?: any, _p1?: any): boolean { return false; }
}
    registerDocumentExtractor(new _TestStub_register_document_extractor_trait_bridge());
  }, 30000);
  it('register_embedding_backend_trait_bridge: register_embedding_backend: trait bridge', () => {    class _TestStub_register_embedding_backend_trait_bridge {
  name(): string { return "test-embedding-backend"; }
  dimensions(): number { return 1; }
  async embed(_p0?: any): Promise<string> { return []; }
}
    registerEmbeddingBackend(new _TestStub_register_embedding_backend_trait_bridge());
  }, 600000);
  it('register_ocr_backend_trait_bridge: register_ocr_backend: trait bridge', () => {    class _TestStub_register_ocr_backend_trait_bridge {
  name(): string { return "test-backend"; }
  async process_image(_p0?: any, _p1?: any): Promise<string> { return "{}"; }
  async process_image_file(_p0?: any, _p1?: any): Promise<string> { return "{}"; }
  supports_language(_p0?: any): boolean { return false; }
  backend_type(): string { return "{}"; }
  supported_languages(): string { return []; }
  supports_table_detection(): boolean { return false; }
  supports_document_processing(): boolean { return false; }
  async process_document(_p0?: any, _p1?: any): Promise<string> { return "{}"; }
}
    registerOcrBackend(new _TestStub_register_ocr_backend_trait_bridge());
  }, 30000);
  it('register_post_processor_trait_bridge: register_post_processor: trait bridge', () => {    class _TestStub_register_post_processor_trait_bridge {
  name(): string { return "test-processor"; }
  async process(_p0?: any, _p1?: any): Promise<void> { return undefined; }
  processing_stage(): string { return "{}"; }
  should_process(_p0?: any, _p1?: any): boolean { return false; }
  estimated_duration_ms(_p0?: any): number { return 1; }
  priority(): number { return 1; }
}
    registerPostProcessor(new _TestStub_register_post_processor_trait_bridge());
  }, 30000);
  it('register_renderer_trait_bridge: register_renderer: trait bridge', () => {    class _TestStub_register_renderer_trait_bridge {
  name(): string { return "test-renderer"; }
  render(_p0?: any): string { return ""; }
}
    registerRenderer(new _TestStub_register_renderer_trait_bridge());
  }, 30000);
  it('register_validator_trait_bridge: register_validator: trait bridge', () => {    class _TestStub_register_validator_trait_bridge {
  name(): string { return "test-validator"; }
  async validate(_p0?: any, _p1?: any): Promise<void> { return undefined; }
  should_validate(_p0?: any, _p1?: any): boolean { return false; }
  priority(): number { return 1; }
}
    registerValidator(new _TestStub_register_validator_trait_bridge());
  }, 30000);
  it('unregister_document_extractor_after_register: unregister_document_extractor', () => {    unregisterDocumentExtractor("test-extractor");
  }, 30000);
  it('unregister_embedding_backend_after_register: unregister_embedding_backend', () => {    unregisterEmbeddingBackend("test-embedding-backend");
  }, 600000);
  it('unregister_post_processor_after_register: unregister_post_processor', () => {    unregisterPostProcessor("test-processor");
  }, 30000);
  it('unregister_renderer_after_register: unregister_renderer', () => {    unregisterRenderer("test-renderer");
  }, 30000);
  it('unregister_validator_after_register: unregister_validator', () => {    unregisterValidator("test-validator");
  }, 30000);
});
