# 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
# frozen_string_literal: true

require 'kreuzberg'
require 'json'
require 'spec_helper'

RSpec.describe 'plugin_api' do
  it 'register_document_extractor_trait_bridge: register_document_extractor: trait bridge' do
    stub_register_document_extractor_trait_bridge = Class.new do
      def name = 'test-extractor'
      def initialize
        nil
      end
      def shutdown
        nil
      end
      def version = '1.0.0'
      def extract_bytes(content, mime_type, config) = '{}'
      def supported_mime_types = []
    end.new
    Kreuzberg.register_document_extractor(stub_register_document_extractor_trait_bridge, 'test-extractor')

    Kreuzberg.unregister_document_extractor('test-extractor')
  end

  it 'register_embedding_backend_trait_bridge: register_embedding_backend: trait bridge' do
    stub_register_embedding_backend_trait_bridge = Class.new do
      def name = 'test-embedding-backend'
      def initialize
        nil
      end
      def shutdown
        nil
      end
      def version = '1.0.0'
      def dimensions = 1
      def embed(texts) = []
    end.new
    Kreuzberg.register_embedding_backend(stub_register_embedding_backend_trait_bridge, 'test-embedding-backend')

    Kreuzberg.unregister_embedding_backend('test-embedding-backend')
  end

  it 'register_ocr_backend_trait_bridge: register_ocr_backend: trait bridge' do
    stub_register_ocr_backend_trait_bridge = Class.new do
      def name = 'test-backend'
      def initialize
        nil
      end
      def shutdown
        nil
      end
      def version = '1.0.0'
      def process_image(image_bytes, config) = '{}'
      def supports_language(lang) = false
      def backend_type = '{}'
    end.new
    Kreuzberg.register_ocr_backend(stub_register_ocr_backend_trait_bridge, 'test-backend')

    Kreuzberg.unregister_ocr_backend('test-backend')
  end

  it 'register_post_processor_trait_bridge: register_post_processor: trait bridge' do
    stub_register_post_processor_trait_bridge = Class.new do
      def name = 'test-processor'
      def initialize
        nil
      end
      def shutdown
        nil
      end
      def version = '1.0.0'
      def process(result, config) = nil
      def processing_stage = '{}'
    end.new
    Kreuzberg.register_post_processor(stub_register_post_processor_trait_bridge, 'test-processor')

    Kreuzberg.unregister_post_processor('test-processor')
  end

  it 'register_renderer_trait_bridge: register_renderer: trait bridge' do
    stub_register_renderer_trait_bridge = Class.new do
      def name = 'test-renderer'
      def initialize
        nil
      end
      def shutdown
        nil
      end
      def version = '1.0.0'
      def render(doc) = ''
    end.new
    Kreuzberg.register_renderer(stub_register_renderer_trait_bridge, 'test-renderer')

    Kreuzberg.unregister_renderer('test-renderer')
  end

  it 'register_validator_trait_bridge: register_validator: trait bridge' do
    stub_register_validator_trait_bridge = Class.new do
      def name = 'test-validator'
      def initialize
        nil
      end
      def shutdown
        nil
      end
      def version = '1.0.0'
      def validate(result, config) = nil
    end.new
    Kreuzberg.register_validator(stub_register_validator_trait_bridge, 'test-validator')

    Kreuzberg.unregister_validator('test-validator')
  end

  it 'unregister_document_extractor_after_register: unregister_document_extractor' do
    Kreuzberg.unregister_document_extractor('test-extractor')

  end

  it 'unregister_embedding_backend_after_register: unregister_embedding_backend' do
    Kreuzberg.unregister_embedding_backend('test-embedding-backend')

  end

  it 'unregister_post_processor_after_register: unregister_post_processor' do
    Kreuzberg.unregister_post_processor('test-processor')

  end

  it 'unregister_renderer_after_register: unregister_renderer' do
    Kreuzberg.unregister_renderer('test-renderer')

  end

  it 'unregister_validator_after_register: unregister_validator' do
    Kreuzberg.unregister_validator('test-validator')

  end
end
