// 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
// swift-format-ignore-file

import XCTest
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
import Kreuzberg
import RustBridge

/// E2e tests for category: batch.
final class BatchTests: XCTestCase {
    func testBatchBytesInvalidMime() throws {
        // batch_extract_bytes_sync invalid MIME
        let _item_itemsArray_0 = try Kreuzberg.batchBytesItemFromJson("{\"content\":[72,101,108,108,111],\"mime_type\":\"application/x-nonexistent\"}")
        let itemsArray = [_item_itemsArray_0]
        let result = try Kreuzberg.batchExtractBytesSync(items: itemsArray)
    }

    func testBatchExtractBytesHappy() async throws {
        // batch_extract_bytes: happy path with mixed inputs
        let _item_itemsArray_0 = try Kreuzberg.batchBytesItemFromJson("{\"content\":[72,101,108,108,111,44,32,119,111,114,108,100,33],\"mime_type\":\"text/plain\"}")
        let _item_itemsArray_1 = try Kreuzberg.batchBytesItemFromJson("{\"content\":[60,104,116,109,108,62,60,98,111,100,121,62,84,101,115,116,60,47,98,111,100,121,62,60,47,104,116,109,108,62],\"mime_type\":\"text/html\"}")
        let itemsArray = [_item_itemsArray_0, _item_itemsArray_1]
        let result = try await Kreuzberg.batchExtractBytes(items: itemsArray)
        XCTAssertGreaterThanOrEqual(result.count, 1)
    }

    func testBatchExtractBytesMixedFormat() async throws {
        // batch_extract_bytes: handles unsupported MIME gracefully
        let _item_itemsArray_0 = try Kreuzberg.batchBytesItemFromJson("{\"content\":[80,68,70,32,112,108,97,99,101,104,111,108,100,101,114],\"mime_type\":\"application/x-unknown\"}")
        let itemsArray = [_item_itemsArray_0]
        let result = try await Kreuzberg.batchExtractBytes(items: itemsArray)
    }

    func testBatchExtractBytesSyncEmptyList() throws {
        // batch_extract_bytes_sync: empty batch
        let result = try Kreuzberg.batchExtractBytesSync(items: [])
        XCTAssertEqual(result.count, 0)
    }

    func testBatchExtractBytesSyncInvalidMime() throws {
        // batch_extract_bytes_sync: unsupported MIME
        let _item_itemsArray_0 = try Kreuzberg.batchBytesItemFromJson("{\"content\":[100,97,116,97],\"mime_type\":\"application/x-unknown\"}")
        let itemsArray = [_item_itemsArray_0]
        let result = try Kreuzberg.batchExtractBytesSync(items: itemsArray)
    }

    func testBatchFileAsyncBasic() async throws {
        // Extract text from multiple files asynchronously
        let _item_pathsArray_0 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"pdf/fake_memo.pdf\"}")
        let _item_pathsArray_1 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"text/fake_text.txt\"}")
        let pathsArray = [_item_pathsArray_0, _item_pathsArray_1]
        let result = try await Kreuzberg.batchExtractFiles(paths: pathsArray)
    }

    func testBatchFileAsyncNotFound() async throws {
        // batch_extract_file async nonexistent
        let _item_pathsArray_0 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"/nonexistent/a.pdf\"}")
        let pathsArray = [_item_pathsArray_0]
        let result = try await Kreuzberg.batchExtractFiles(paths: pathsArray)
    }

    func testBatchFileNotFound() throws {
        // batch_extract_file_sync nonexistent
        let _item_pathsArray_0 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"/nonexistent/a.pdf\"}")
        let _item_pathsArray_1 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"/nonexistent/b.txt\"}")
        let pathsArray = [_item_pathsArray_0, _item_pathsArray_1]
        let result = try Kreuzberg.batchExtractFilesSync(paths: pathsArray)
    }

    func testBatchFilePartial() throws {
        // batch_extract_file_sync mixed
        let _item_pathsArray_0 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"text/plain.txt\"}")
        let _item_pathsArray_1 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"/nonexistent/missing.pdf\"}")
        let pathsArray = [_item_pathsArray_0, _item_pathsArray_1]
        let result = try Kreuzberg.batchExtractFilesSync(paths: pathsArray)
    }

    func testBatchFileSyncBasic() throws {
        // Extract text from multiple files synchronously
        let _item_pathsArray_0 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"pdf/fake_memo.pdf\"}")
        let _item_pathsArray_1 = try Kreuzberg.batchFileItemFromJson("{\"path\":\"text/fake_text.txt\"}")
        let pathsArray = [_item_pathsArray_0, _item_pathsArray_1]
        let result = try Kreuzberg.batchExtractFilesSync(paths: pathsArray)
    }

}
