import org.jsonschema2pojo.SourceType

plugins {
    id "com.github.eirnym.js2p" version "1.0"
}

compileTestFixturesKotlin.compilerOptions.allWarningsAsErrors = false
compileTestKotlin.compilerOptions.allWarningsAsErrors = false


// Convert yaml to java: relationaldb.models
jsonSchema2Pojo {
    sourceType = SourceType.YAMLSCHEMA
    source = files("${sourceSets.main.output.resourcesDir}/db_models")
    targetDirectory = new File(project.buildDir, 'generated/src/gen/java/')
    removeOldOutput = true

    targetPackage = 'io.airbyte.cdk.integrations.source.relationaldb.models'

    useLongIntegers = true
    generateBuilders = true
    includeConstructors = false
    includeSetters = true
}

tasks.register('generate').configure {
    dependsOn tasks.named('generateJsonSchema2Pojo')
}

dependencies {

    implementation project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-dependencies')
    implementation project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-core')

    implementation 'io.debezium:debezium-api:2.4.0.Final'
    implementation 'io.debezium:debezium-embedded:2.4.0.Final'
    implementation 'org.codehaus.plexus:plexus-utils:4.0.1'

    testFixturesImplementation project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-dependencies')
    testFixturesImplementation testFixtures(project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-dependencies'))
    testFixturesImplementation project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-core')
    testFixturesApi testFixtures(project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-core'))

    testFixturesImplementation 'net.sourceforge.argparse4j:argparse4j:0.9.0'
    testFixturesImplementation 'io.swagger:swagger-annotations:1.6.14'
    testFixturesImplementation 'org.hamcrest:hamcrest-all:1.3'
    testFixturesImplementation 'org.junit.platform:junit-platform-launcher:1.11.0'

    testImplementation project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-datastore-postgres')
    testImplementation testFixtures(project(':airbyte-cdk:java:airbyte-cdk:airbyte-cdk-datastore-postgres'))

    testImplementation 'uk.org.webcompere:system-stubs-jupiter:2.1.6'
    testImplementation 'org.mockito.kotlin:mockito-kotlin:5.4.0'
}
