import org.jetbrains.compose.desktop.application.dsl.TargetFormat

plugins {
    kotlin("jvm") version "2.0.0"
    id("org.jetbrains.compose") version "1.6.11"
    kotlin("plugin.compose") version "2.0.0"
    kotlin("plugin.serialization") version "2.0.0"
}

group = "com.autotrade"
version = "1.0.0"

repositories {
    mavenCentral()
    google()
    maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}

dependencies {
    implementation(compose.desktop.currentOs)
    implementation(compose.material)
    implementation(compose.materialIconsExtended)

    // Ktor (Network)
    val ktorVersion = "2.3.11"
    implementation("io.ktor:ktor-client-cio:$ktorVersion")
    implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
    implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion")
    implementation("io.ktor:ktor-client-logging:${ktorVersion}")

    implementation("ch.qos.logback:logback-classic:1.4.11")

    // Database (Exposed & SQLite)
    // H2 Database (네이티브 라이브러리 없는 순수 자바 DB)
    implementation("com.h2database:h2:2.2.224")

    implementation("io.ktor:ktor-client-websockets:${ktorVersion}")

    // SQL 프레임워크 (Exposed)
    val exposedVersion = "0.50.1"
    implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
    implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion") // 날짜 처리를 위해 필수

    // Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1")
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-swing:1.8.1")

    val langchain4jVersion = "1.10.0"
//    implementation("dev.langchain4j:langchain4j:$langchain4jVersion")
//    implementation("dev.langchain4j:langchain4j-open-ai:$langchain4jVersion")
    // llama.cpp 서버가 OpenAI API와 호환되므로 이 라이브러리를 사용합니다.


    implementation("dev.langchain4j:langchain4j:${langchain4jVersion}")
    implementation("dev.langchain4j:langchain4j-core:${langchain4jVersion}")
    implementation("dev.langchain4j:langchain4j-open-ai:${langchain4jVersion}")
    implementation("dev.langchain4j:langchain4j-community-lucene:1.10.0-beta18")
}

compose.desktop {
    application {
        mainClass = "MainKt"
        nativeDistributions {
            targetFormats(TargetFormat.Dmg)
            packageName = "AutoTradeAI"
            macOS {
                bundleID = "com.autotrade.ai"
            }
        }
    }
}

kotlin {
    jvmToolchain(17) // 이 줄이 JDK 17 사용을 강제합니다.
}