// 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
package dev.kreuzberg.e2e

import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
import kotlin.test.assertFalse
import kotlin.test.assertFailsWith
import kotlinx.coroutines.runBlocking
import dev.kreuzberg.Kreuzberg
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import dev.kreuzberg.ExtractionConfig

/** E2e tests for category: format_specific. */
class FormatSpecificTest {

    companion object {
        private val MAPPER = ObjectMapper().registerModule(Jdk8Module()).registerKotlinModule().setPropertyNamingStrategy(com.fasterxml.jackson.databind.PropertyNamingStrategies.SNAKE_CASE)
    }
    @Test
    fun testFormatDocxStandalone() = runBlocking {
        // Standalone DOCX extraction using extract_bytes_sync
        val result = Kreuzberg.extractBytesSync("docx/fake.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", ExtractionConfig())
        assertTrue(result.content.length >= 20, "expected length >= 20")
    }

    @Test
    fun testFormatHwpxStandalone() = runBlocking {
        // Standalone HWPX extraction using extract_bytes_sync
        val result = Kreuzberg.extractBytesSync("hwpx/simple.hwpx", "application/haansofthwpx", ExtractionConfig())
        assertTrue(result.content.length >= 20, "expected length >= 20")
        assertTrue(result.content.contains("Hello from HWPX"), "expected to contain: " + "Hello from HWPX")
    }

    @Test
    fun testFormatPdfText() = runBlocking {
        // Standalone PDF text extraction using extract_bytes_sync
        val result = Kreuzberg.extractBytesSync("pdf/fake_memo.pdf", "application/pdf", ExtractionConfig())
        assertTrue(result.content.length >= 50, "expected length >= 50")
        assertTrue(result.content.contains("Mallori") || result.content.contains("May"), "expected to contain at least one of the specified values")
    }

    @Test
    fun testFormatPptx() = runBlocking {
        // PPTX presentation extraction using extract_file_sync
        val result = Kreuzberg.extractFileSync("pptx/simple.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", ExtractionConfig())
    }

    @Test
    fun testFormatXlsx() = runBlocking {
        // XLSX spreadsheet extraction using extract_file_sync
        val result = Kreuzberg.extractFileSync("xlsx/stanley_cups.xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", ExtractionConfig())
    }

}
