plugins {
    id "java"
    id "idea"
    id "io.qameta.allure" version "2.12.0"
    id "com.avast.gradle.docker-compose" version "0.17.12"
}

ext {
    grpcVersion = '1.72.0'
    protoVersion = '4.30.2'
    containerVersion = '1.20.6'
    kafkaVersion = "7.9.0-ce"
    awsVersion = '2.31.21'
    ceVersion = "4.0.1"
    allureVersion = "2.29.1"
    playwrightVersion = "1.52.0"
}

group = 'com.HybridTestFramework'
version = '1.0-SNAPSHOT'

java {
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17
}

repositories {
    mavenCentral()
    maven {
        url = 'https://maven-central.storage-download.googleapis.com/maven2/'
    }
    maven {
        url = 'https://packages.confluent.io/maven/'
    }
    google()
    gradlePluginPortal()
}

allure {
    version = "2.32.0"
}

dockerCompose {
    useComposeFiles = ['docker-compose.yml']
    startedServices = ['chrome', 'firefox']
    scale = [chrome: 2, firefox: 2]
    stopContainers = true
    removeContainers = true
}

//tasks.withType(JavaCompile) {
//    options.compilerArgs << "-Xlint:deprecation"
//    options.compilerArgs << "-Xlint:unchecked"
//}

tasks.register('web', Test) {
    environment 'PLAYWRIGHT_LOG', 'off'
    useTestNG {
        useDefaultListeners = true
        suites 'src/test/java/suite/webng.xml'
    }
    testLogging {
        events "passed", "skipped", "failed"
        showStandardStreams = true
    }
    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

tasks.register('lambdaweb', Test) {
    environment 'PLAYWRIGHT_LOG', 'off'
    useTestNG {
        useDefaultListeners = true
        suites 'src/test/java/suite/webng_lambda.xml'
    }
    testLogging {
        events "passed", "skipped", "failed"
        showStandardStreams = true
    }
    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

tasks.register('api', Test) {
    useTestNG {
        useDefaultListeners = true
        suites 'src/test/java/suite/aping.xml'
    }
    testLogging {
        events "passed", "skipped", "failed"
        showStandardStreams = true
    }
    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

tasks.register('mobile', Test) {
    useTestNG {
        suites 'src/test/java/suite/mobileng.xml'
    }
    testLogging {
        events "passed", "skipped", "failed"
        showStandardStreams = true
    }
    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

tasks.register('lambdamobile', Test) {
    useTestNG {
        useDefaultListeners = true
        suites 'src/test/java/suite/mobileng_lambda.xml'
    }
    testLogging {
        events "passed", "skipped", "failed"
        showStandardStreams = true
    }
    beforeTest { descriptor ->
        logger.lifecycle("Running test: " + descriptor)
    }
}

dependencies {
    implementation project(":contract")
    implementation "software.amazon.awssdk:s3:${awsVersion}"
    implementation "software.amazon.awssdk:sqs:${awsVersion}"
    implementation "software.amazon.awssdk:sns:${awsVersion}"
    implementation 'com.google.cloud:google-cloud-pubsub:1.138.0'
    implementation 'org.seleniumhq.selenium:selenium-java:4.31.0'
    implementation 'org.seleniumhq.selenium:selenium-remote-driver:4.32.0'
    implementation 'io.appium:java-client:9.4.0'
    implementation 'org.awaitility:awaitility:4.3.0'
    implementation 'org.wiremock:wiremock:3.12.1'
    implementation 'org.apache.sshd:sshd-core:2.15.0'
    implementation 'org.assertj:assertj-core:3.27.3'
    implementation 'org.hamcrest:hamcrest-all:1.3'
    implementation 'org.testng:testng:7.11.0'
    implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    implementation 'commons-io:commons-io:2.19.0'
    implementation 'com.aventstack:extentreports:5.1.2'
    implementation 'net.sourceforge.javacsv:javacsv:2.0'
    implementation 'org.apache.poi:poi-ooxml:5.4.0'
    implementation 'org.apache.poi:poi:5.4.0'
    implementation 'org.apache.xmlbeans:xmlbeans:5.2.2'
    implementation 'com.microsoft.sqlserver:mssql-jdbc:12.10.0.jre11'
    implementation 'org.slf4j:slf4j-simple:2.0.17'
    implementation 'net.datafaker:datafaker:2.4.3'
    implementation 'io.rest-assured:rest-assured:5.5.1'
    implementation 'io.rest-assured:json-schema-validator:5.5.1'
    implementation 'io.rest-assured:json-path:5.5.1'
    implementation 'com.atlassian.oai:swagger-request-validator-restassured:2.44.1'
    implementation 'com.atlassian.oai:swagger-request-validator-pact:2.44.1'
    implementation 'org.json:json:20250517'
    implementation 'com.konghq:unirest-java:3.14.5'
    implementation 'net.lightbody.bmp:browsermob-core:2.1.5'
    implementation 'org.zaproxy:zap-clientapi:1.16.0'
    implementation 'org.zaproxy:zap:2.16.1'
    implementation 'net.lingala.zip4j:zip4j:2.11.5'
    implementation "io.qameta.allure:allure-gradle:2.8.1"
    implementation "io.qameta.allure:allure-testng:${allureVersion}"
    implementation "io.qameta.allure:allure-rest-assured:${allureVersion}"
    implementation "io.qameta.allure:allure-attachments:${allureVersion}"
    implementation 'org.apache.avro:avro:1.12.0'
    implementation "org.apache.avro:avro-tools:1.12.0"
    implementation "org.apache.kafka:kafka-clients:${kafkaVersion}"
    implementation "org.apache.kafka:kafka-streams:${kafkaVersion}"
    implementation "io.confluent:kafka-avro-serializer:7.9.0"
    implementation "io.cloudevents:cloudevents-core:${ceVersion}"
    implementation "io.cloudevents:cloudevents-api:${ceVersion}"
    implementation "io.cloudevents:cloudevents-kafka:${ceVersion}"
    implementation "io.cloudevents:cloudevents-protobuf:${ceVersion}"
    implementation 'cloud.localstack:localstack-utils:0.2.23'
    implementation 'com.google.guava:guava:33.4.7-jre'
    runtimeOnly "io.grpc:grpc-netty-shaded:${grpcVersion}"
    implementation "io.grpc:grpc-protobuf:${grpcVersion}"
    implementation "io.grpc:grpc-stub:${grpcVersion}"
    implementation "io.grpc:grpc-all:${grpcVersion}"
    testImplementation "io.grpc:grpc-testing:${grpcVersion}"
    implementation 'javax.annotation:javax.annotation-api:1.3.2'
    implementation "com.google.protobuf:protobuf-java:${protoVersion}"
    runtimeOnly "com.google.protobuf:protobuf-java-util:${protoVersion}"
    implementation "org.testcontainers:testcontainers:${containerVersion}"
    implementation "org.testcontainers:selenium:${containerVersion}"
    implementation "org.testcontainers:kafka:${containerVersion}"
    implementation "org.testcontainers:localstack:${containerVersion}"
    implementation "org.testcontainers:gcloud:${containerVersion}"
    implementation 'org.projectlombok:lombok:1.18.36'
    annotationProcessor 'org.projectlombok:lombok:1.18.36'
    implementation 'com.typesafe:config:1.4.3'
    implementation "com.microsoft.playwright:playwright:${playwrightVersion}"
    implementation 'com.browserstack:browserstack-java-sdk:1.32.6'
}

configurations.configureEach {
    exclude group: 'org.slf4j', module: 'slf4j-reload4j'
    exclude group: 'org.slf4j', module: 'slf4j-simple'
}