buildscript {
    ext.kotlinVersion = "1.9.24"
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:8.7.3")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
    }
}

apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android'

android {
    namespace 'finos.sdk.ekyc'
    compileSdk 35

    sourceSets {
        main {
            java.srcDirs = ['src/main/java']
        }
    }

    defaultConfig {
        minSdkVersion 24
        targetSdkVersion 34
        consumerProguardFiles 'consumer-rules.pro'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    // Don't set kotlinOptions.languageVersion - let React Native plugin manage it
    // React Native plugin will automatically configure Kotlin languageVersion

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    google()
    mavenCentral()
    mavenLocal()
    
    // GitHub Packages for FINOS eKYC SDK
    maven {
        url = uri("https://maven.pkg.github.com/finosvn/finos.ekyc.sdk")
        credentials {
            username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_USER")
            password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN")
        }
    }
}

dependencies {
    implementation 'com.facebook.react:react-android'

    // Finos eKYC SDK dependencies from GitHub Packages Maven repository
    def sdkVersion = "1.5.5.3"
    implementation("finos.sdk.ekyc:ekyc:$sdkVersion")
    implementation("finos.sdk.ekyc:ekycui:$sdkVersion")
    implementation("finos.sdk.ekyc:nfc:$sdkVersion")
    implementation("finos.sdk.ekyc:ocr:$sdkVersion")
    implementation("finos.sdk.ekyc:liveness:$sdkVersion")
    implementation("finos.sdk.ekyc:faceservice:$sdkVersion")
    implementation("finos.sdk.ekyc:c06:$sdkVersion")
    implementation("finos.sdk.ekyc:sdkcore:$sdkVersion")
    implementation("finos.sdk.ekyc:sdkcorecamera:$sdkVersion")
    implementation("finos.sdk.ekyc:sdkui:$sdkVersion")
    implementation("finos.sdk.ekyc:qrcode:$sdkVersion")
    implementation("finos.sdk.ekyc:smsotp:$sdkVersion")
    implementation("finos.sdk.ekyc:esign:$sdkVersion")
}
