buildscript {    
    repositories {
        google()
        mavenCentral()
    }
}

plugins {
  id 'com.android.library'
  id 'org.jetbrains.kotlin.android'        // <— make sure this is here
    id("org.jetbrains.kotlin.plugin.compose") version "2.0.21"
}


def getExtOrDefault(name, defaultValue) {
    return rootProject.ext.has(name) ? rootProject.ext.get(name) : defaultValue
}

android {
    namespace "com.reactnativecmscuresdk"
    
    compileSdkVersion 35
    
    defaultConfig {
        minSdk 24
        targetSdk 35
        versionCode 1
        versionName "1.0"
    }
    
    
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        abortOnError false
    }
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    
    kotlinOptions {
        jvmTarget = "17"
    }
    
    buildFeatures {
        compose true
    }
    
    composeOptions {
        kotlinCompilerExtensionVersion = "1.5.15"
    }
}

dependencies {
    // React Native
    compileOnly 'com.facebook.react:react-native:+'
    
    // Kotlin
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$rootProject.ext.kotlinVersion"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3'
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
    
    def composeBom = platform("androidx.compose:compose-bom:2024.02.00")
    implementation composeBom

    // CMSCure SDK dependencies
    implementation 'androidx.core:core-ktx:1.12.0'
    implementation 'androidx.appcompat:appcompat:1.6.1'
    
    // Compose (required by CMSCure SDK)
    implementation platform('androidx.compose:compose-bom:2024.02.00')
    implementation 'androidx.compose.ui:ui'
    implementation 'androidx.compose.runtime:runtime'
    implementation 'androidx.compose.material3:material3'
    implementation "androidx.compose.ui:ui-graphics"
    
    // Networking
    implementation 'com.squareup.retrofit2:retrofit:2.9.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
    implementation 'com.squareup.okhttp3:okhttp:4.12.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
    implementation 'com.google.code.gson:gson:2.10.1'
    
    // Socket.IO
    implementation('io.socket:socket.io-client:2.1.0') {
        exclude group: 'org.json', module: 'json'
    }
    
    // Image loading (Coil)
    implementation 'io.coil-kt:coil-compose:2.5.0'

    implementation "androidx.compose.compiler:compiler:1.5.15"
}