// 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
const std = @import("std");
const testing = std.testing;
const kreuzberg = @import("kreuzberg");

// Suppress C++ global destructor aborts that break zig's --listen=- IPC
extern "c" fn signal(sig: i32, handler: usize) usize;
var _abort_handler_installed: bool = false;
fn suppress_abort() void {
    if (!_abort_handler_installed) {
        // SIGABRT = 6 on POSIX; SIG_IGN = 1
        _ = signal(6, 1);
        _abort_handler_installed = true;
    }
}

// E2e tests for category: plugin_api

test "register_document_extractor_trait_bridge" {
    // register_document_extractor: trait bridge
    suppress_abort();
    const TestStub_register_document_extractor_trait_bridge = struct {
        pub fn extract_bytes(_: *@This(), _: [*c]const u8, _: [*c]const u8, _: [*c]const u8) ![*c]const u8 { return ""; }
        pub fn extract_file(_: *@This(), _: [*c]const u8, _: [*c]const u8, _: [*c]const u8) ![*c]const u8 { return ""; }
        pub fn supported_mime_types(_: *@This()) [*c]const u8 { return "[]"; }
        pub fn priority(_: *@This()) i32 { return 0; }
        pub fn can_handle(_: *@This(), _: [*c]const u8, _: [*c]const u8) i32 { return 0; }
    };
    var stub_register_document_extractor_trait_bridge = TestStub_register_document_extractor_trait_bridge{};
    const vtable_register_document_extractor_trait_bridge = kreuzberg.make_document_extractor_vtable(TestStub_register_document_extractor_trait_bridge, &stub_register_document_extractor_trait_bridge);
    var out_err_register_document_extractor_trait_bridge: ?[*c]u8 = null;
    _ = kreuzberg.register_document_extractor("test", vtable_register_document_extractor_trait_bridge, &stub_register_document_extractor_trait_bridge, @ptrCast(&out_err_register_document_extractor_trait_bridge));
}

test "register_embedding_backend_trait_bridge" {
    // register_embedding_backend: trait bridge
    suppress_abort();
    const TestStub_register_embedding_backend_trait_bridge = struct {
        pub fn dimensions(_: *@This()) u64 { return 0; }
        pub fn embed(_: *@This(), _: [*c]const u8) ![*c]const u8 { return ""; }
    };
    var stub_register_embedding_backend_trait_bridge = TestStub_register_embedding_backend_trait_bridge{};
    const vtable_register_embedding_backend_trait_bridge = kreuzberg.make_embedding_backend_vtable(TestStub_register_embedding_backend_trait_bridge, &stub_register_embedding_backend_trait_bridge);
    var out_err_register_embedding_backend_trait_bridge: ?[*c]u8 = null;
    _ = kreuzberg.register_embedding_backend("test", vtable_register_embedding_backend_trait_bridge, &stub_register_embedding_backend_trait_bridge, @ptrCast(&out_err_register_embedding_backend_trait_bridge));
}

test "register_ocr_backend_trait_bridge" {
    // register_ocr_backend: trait bridge
    suppress_abort();
    const TestStub_register_ocr_backend_trait_bridge = struct {
        pub fn process_image(_: *@This(), _: [*c]const u8, _: [*c]const u8) ![*c]const u8 { return ""; }
        pub fn process_image_file(_: *@This(), _: [*c]const u8, _: [*c]const u8) ![*c]const u8 { return ""; }
        pub fn supports_language(_: *@This(), _: [*c]const u8) i32 { return 0; }
        pub fn backend_type(_: *@This()) [*c]const u8 { return "{}"; }
        pub fn supported_languages(_: *@This()) [*c]const u8 { return "[]"; }
        pub fn supports_table_detection(_: *@This()) i32 { return 0; }
        pub fn supports_document_processing(_: *@This()) i32 { return 0; }
        pub fn process_document(_: *@This(), _: [*c]const u8, _: [*c]const u8) ![*c]const u8 { return ""; }
    };
    var stub_register_ocr_backend_trait_bridge = TestStub_register_ocr_backend_trait_bridge{};
    const vtable_register_ocr_backend_trait_bridge = kreuzberg.make_ocr_backend_vtable(TestStub_register_ocr_backend_trait_bridge, &stub_register_ocr_backend_trait_bridge);
    var out_err_register_ocr_backend_trait_bridge: ?[*c]u8 = null;
    _ = kreuzberg.register_ocr_backend("test", vtable_register_ocr_backend_trait_bridge, &stub_register_ocr_backend_trait_bridge, @ptrCast(&out_err_register_ocr_backend_trait_bridge));
}

test "register_post_processor_trait_bridge" {
    // register_post_processor: trait bridge
    suppress_abort();
    const TestStub_register_post_processor_trait_bridge = struct {
        pub fn process(_: *@This(), _: [*c]const u8, _: [*c]const u8) !void {}
        pub fn processing_stage(_: *@This()) [*c]const u8 { return "{}"; }
        pub fn should_process(_: *@This(), _: [*c]const u8, _: [*c]const u8) i32 { return 0; }
        pub fn estimated_duration_ms(_: *@This(), _: [*c]const u8) u64 { return 0; }
        pub fn priority(_: *@This()) i32 { return 0; }
    };
    var stub_register_post_processor_trait_bridge = TestStub_register_post_processor_trait_bridge{};
    const vtable_register_post_processor_trait_bridge = kreuzberg.make_post_processor_vtable(TestStub_register_post_processor_trait_bridge, &stub_register_post_processor_trait_bridge);
    var out_err_register_post_processor_trait_bridge: ?[*c]u8 = null;
    _ = kreuzberg.register_post_processor("test", vtable_register_post_processor_trait_bridge, &stub_register_post_processor_trait_bridge, @ptrCast(&out_err_register_post_processor_trait_bridge));
}

test "register_renderer_trait_bridge" {
    // register_renderer: trait bridge
    suppress_abort();
    const TestStub_register_renderer_trait_bridge = struct {
        pub fn render(_: *@This(), _: [*c]const u8) ![*c]const u8 { return ""; }
    };
    var stub_register_renderer_trait_bridge = TestStub_register_renderer_trait_bridge{};
    const vtable_register_renderer_trait_bridge = kreuzberg.make_renderer_vtable(TestStub_register_renderer_trait_bridge, &stub_register_renderer_trait_bridge);
    var out_err_register_renderer_trait_bridge: ?[*c]u8 = null;
    _ = kreuzberg.register_renderer("test", vtable_register_renderer_trait_bridge, &stub_register_renderer_trait_bridge, @ptrCast(&out_err_register_renderer_trait_bridge));
}

test "register_validator_trait_bridge" {
    // register_validator: trait bridge
    suppress_abort();
    const TestStub_register_validator_trait_bridge = struct {
        pub fn validate(_: *@This(), _: [*c]const u8, _: [*c]const u8) !void {}
        pub fn should_validate(_: *@This(), _: [*c]const u8, _: [*c]const u8) i32 { return 0; }
        pub fn priority(_: *@This()) i32 { return 0; }
    };
    var stub_register_validator_trait_bridge = TestStub_register_validator_trait_bridge{};
    const vtable_register_validator_trait_bridge = kreuzberg.make_validator_vtable(TestStub_register_validator_trait_bridge, &stub_register_validator_trait_bridge);
    var out_err_register_validator_trait_bridge: ?[*c]u8 = null;
    _ = kreuzberg.register_validator("test", vtable_register_validator_trait_bridge, &stub_register_validator_trait_bridge, @ptrCast(&out_err_register_validator_trait_bridge));
}

test "unregister_document_extractor_after_register" {
    // unregister_document_extractor
    suppress_abort();
    _ = try kreuzberg.unregister_document_extractor("test-extractor");
}

test "unregister_embedding_backend_after_register" {
    // unregister_embedding_backend
    suppress_abort();
    _ = try kreuzberg.unregister_embedding_backend("test-embedding-backend");
}

test "unregister_post_processor_after_register" {
    // unregister_post_processor
    suppress_abort();
    _ = try kreuzberg.unregister_post_processor("test-processor");
}

test "unregister_renderer_after_register" {
    // unregister_renderer
    suppress_abort();
    _ = try kreuzberg.unregister_renderer("test-renderer");
}

test "unregister_validator_after_register" {
    // unregister_validator
    suppress_abort();
    _ = try kreuzberg.unregister_validator("test-validator");
}
