<?php
// 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


declare(strict_types=1);

namespace Kreuzberg\E2e;

use PHPUnit\Framework\TestCase;
use Kreuzberg\Kreuzberg;
use Kreuzberg\BatchBytesItem;
use Kreuzberg\BatchFileItem;
use Kreuzberg\ExtractionConfig;

/** E2e tests for category: batch. */
final class BatchTest extends TestCase
{

    /** batch_extract_bytes_sync invalid MIME */
    public function test_batch_bytes_invalid_mime(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractBytesSync([new BatchBytesItem(content: "\x48\x65\x6c\x6c\x6f", mimeType: "application/x-nonexistent")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** batch_extract_bytes: happy path with mixed inputs */
    public function test_batch_extract_bytes_happy(): void
    {
        $result = Kreuzberg::batchExtractBytes([new BatchBytesItem(content: "\x48\x65\x6c\x6c\x6f\x2c\x20\x77\x6f\x72\x6c\x64\x21", mimeType: "text/plain"), new BatchBytesItem(content: "\x3c\x68\x74\x6d\x6c\x3e\x3c\x62\x6f\x64\x79\x3e\x54\x65\x73\x74\x3c\x2f\x62\x6f\x64\x79\x3e\x3c\x2f\x68\x74\x6d\x6c\x3e", mimeType: "text/html")], \Kreuzberg\ExtractionConfig::from_json('{}'));

            $this->assertGreaterThanOrEqual(1, count($result));


    }


    /** batch_extract_bytes: handles unsupported MIME gracefully */
    public function test_batch_extract_bytes_mixed_format(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractBytes([new BatchBytesItem(content: "\x50\x44\x46\x20\x70\x6c\x61\x63\x65\x68\x6f\x6c\x64\x65\x72", mimeType: "application/x-unknown")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** batch_extract_bytes_sync: empty batch */
    public function test_batch_extract_bytes_sync_empty_list(): void
    {
        $result = Kreuzberg::batchExtractBytesSync([], \Kreuzberg\ExtractionConfig::from_json('{}'));

            $this->assertCount(0, $result);


    }


    /** batch_extract_bytes_sync: unsupported MIME */
    public function test_batch_extract_bytes_sync_invalid_mime(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractBytesSync([new BatchBytesItem(content: "\x64\x61\x74\x61", mimeType: "application/x-unknown")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** Extract text from multiple files asynchronously */
    public function test_batch_file_async_basic(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractFiles([new BatchFileItem(path: "pdf/fake_memo.pdf"), new BatchFileItem(path: "text/fake_text.txt")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** batch_extract_file async nonexistent */
    public function test_batch_file_async_not_found(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractFiles([new BatchFileItem(path: "/nonexistent/a.pdf")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** batch_extract_file_sync nonexistent */
    public function test_batch_file_not_found(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractFilesSync([new BatchFileItem(path: "/nonexistent/a.pdf"), new BatchFileItem(path: "/nonexistent/b.txt")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** batch_extract_file_sync mixed */
    public function test_batch_file_partial(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractFilesSync([new BatchFileItem(path: "text/plain.txt"), new BatchFileItem(path: "/nonexistent/missing.pdf")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }


    /** Extract text from multiple files synchronously */
    public function test_batch_file_sync_basic(): void
    {
        $this->expectNotToPerformAssertions();
        $result = Kreuzberg::batchExtractFilesSync([new BatchFileItem(path: "pdf/fake_memo.pdf"), new BatchFileItem(path: "text/fake_text.txt")], \Kreuzberg\ExtractionConfig::from_json('{}'));


    }

}
