def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

apply plugin: 'com.android.library'

android {
    def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
    if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
        namespace "com.projectmain.rndatawedgeintents"
    }
    
    compileSdkVersion 34
    buildToolsVersion '34.0.0'

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 34
        versionCode 8
        versionName "0.3.14"
        
        // Configuración para Java 8
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_11
            targetCompatibility JavaVersion.VERSION_11
        }
    }

    // Evita conflictos con archivos LICENSE.txt
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
}

dependencies {
    implementation 'com.facebook.react:react-native:+'  // Usa la versión de React Native del proyecto host
    implementation 'androidx.core:core:1.10.0'
    
    // Dependencias recomendadas
    implementation 'androidx.annotation:annotation:1.6.0'  // Para @NonNull y @Nullable
    implementation 'androidx.core:core-ktx:1.10.0'        // Extensiones de Kotlin (opcional)
    
    // Dependencias para testing (opcional)
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test:runner:1.5.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}