plugins {
    id 'java'
    id 'org.springframework.boot' version '3.5.6'
    id 'io.spring.dependency-management' version '1.1.7'
    id 'com.netflix.dgs.codegen' version '7.0.3'
}

group = 'dev.ksan'
version = '0.0.1-SNAPSHOT'
description = 'etfoglasi-server'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(21)
    }
}
configurations.all {
    resolutionStrategy {
        force 'com.graphql-java:java-dataloader:3.3.0'  // Force version 3.3.0
    }
}

repositories {
    mavenCentral()
    maven { url 'https://repo.maven.apache.org/maven2' }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    developmentOnly 'org.springframework.boot:spring-boot-docker-compose'
    runtimeOnly 'org.postgresql:postgresql'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
    implementation "org.springframework.boot:spring-boot-starter-security"
    implementation("org.simplejavamail:simple-java-mail:8.0.1")
    implementation("net.sourceforge.htmlunit:htmlunit:2.70.0")
    runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.13.0")
    implementation("io.jsonwebtoken:jjwt-api:0.13.0")
    runtimeOnly("io.jsonwebtoken:jjwt-impl:0.13.0")
    implementation("org.projectlombok:lombok:1.18.42")
    annotationProcessor 'org.projectlombok:lombok:1.18.42'
    implementation 'com.google.firebase:firebase-admin:9.9.0'



    testImplementation 'org.springframework.security:spring-security-test'
    testRuntimeOnly 'com.h2database:h2'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation("org.testcontainers:postgresql:1.21.3")
    testImplementation("org.testcontainers:junit-jupiter:1.21.4")
    testImplementation("org.mockito:mockito-inline:5.2.0")
    testImplementation 'org.mockito:mockito-core'
}

generateJava {
    schemaPaths = ["${projectDir}/src/main/resources/graphql-client"]
    packageName = 'dev.ksan.etfoglasiserver.codegen'
    generateClient = true
}

tasks.named('test') {
    useJUnitPlatform()

    jvmArgs += [
            "-javaagent:${configurations.testRuntimeClasspath.find { it.name.contains('byte-buddy-agent') }}"
    ]
}
