apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

group = 'com.smartcamera'
version = '0.1.4'

buildscript {
    repositories {
        mavenCentral()
        google()
    }

    dependencies {
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
    }
}

android {
    namespace "com.smartcamera"
    compileSdkVersion safeExtGet("compileSdkVersion", 34)

    defaultConfig {
        minSdkVersion safeExtGet("minSdkVersion", 23)
        targetSdkVersion safeExtGet("targetSdkVersion", 34)
    }

    lintOptions {
        abortOnError false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_17.majorVersion
    }
    
    sourceSets {
        main {
            java.srcDirs = ['src/main/java']
        }
    }
}

repositories {
    mavenCentral()
    google()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.22"
    
    // Kotlin Coroutines
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
    implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
    
    // Google ML Kit Face Detection
    implementation 'com.google.mlkit:face-detection:16.1.6'
    
    // VisionCamera Frame Processor API (compileOnly - provided by peer dependency)
    compileOnly project(':react-native-vision-camera')
    
    // React Native
    compileOnly "com.facebook.react:react-android:+"
}

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