apply plugin: 'com.android.library'
apply plugin: 'com.google.protobuf'

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.1'
    }
}

allprojects {
    repositories {
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

android {
    compileSdkVersion 35

    defaultConfig {
        minSdkVersion 23
        targetSdkVersion 35

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles 'consumer-rules.pro'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    namespace 'com.espressif.provisioning'
}

protobuf {
    protoc {
        artifact = 'com.google.protobuf:protoc:3.21.9'
    }
    generateProtoTasks {
        all().each { task ->
            task.builtins {
                java {
                    option 'lite'
                }
            }
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'org.greenrobot:eventbus:3.3.1'
    implementation 'com.google.protobuf:protobuf-javalite:3.18.0'
    implementation 'com.google.crypto.tink:tink-android:1.12.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    implementation 'androidx.preference:preference:1.2.1'
    implementation 'com.github.yuriy-budiyev:code-scanner:2.1.2'

    // CameraX
    def camerax_version = "1.2.3"
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    implementation "androidx.camera:camera-view:${camerax_version}"

    // ML Kit for QR code scanning
    implementation 'com.google.mlkit:barcode-scanning:17.3.0'

    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
