buildscript {
  ext.getExtOrDefault = {name ->
    return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['TamaraSdk_' + name]
  }

  repositories {
    google()
    mavenCentral()
  }

  dependencies {
    classpath "com.android.tools.build:gradle:8.7.2"
    // noinspection DifferentKotlinGradleVersion
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
  }
}


apply plugin: "com.android.library"
apply plugin: "kotlin-android"
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: 'maven-publish'

apply plugin: "com.facebook.react"

def getExtOrIntegerDefault(name) {
  return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["TamaraSdk_" + name]).toInteger()
}

android {
  namespace "com.tamarasdk"

  compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

  defaultConfig {
    minSdkVersion getExtOrIntegerDefault("minSdkVersion")
    targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
  }

  buildFeatures {
    viewBinding true
    buildConfig true
  }

  buildTypes {
    release {
      minifyEnabled false
    }
  }

  lintOptions {
    disable "GradleCompatible"
  }

  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }

  sourceSets {
    main {
      java.srcDirs += [
        "generated/java",
        "generated/jni"
      ]
    }
  }
}

repositories {
  mavenCentral()
  google()
}

def kotlin_version = getExtOrDefault("kotlinVersion")

dependencies {
  implementation "com.facebook.react:react-android"
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
  implementation 'androidx.appcompat:appcompat:1.7.0'
  implementation 'androidx.core:core-ktx:1.13.1'
  implementation 'com.google.dagger:dagger-android-support:2.53.1'
  implementation "com.google.dagger:dagger:2.53.1"
  implementation 'com.squareup.retrofit2:retrofit:2.11.0'
  implementation 'com.squareup.retrofit2:converter-gson:2.11.0'
  implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
  implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.6'
  implementation 'androidx.legacy:legacy-support-v4:1.0.0'
  implementation "androidx.navigation:navigation-fragment-ktx:2.8.3"
  implementation 'androidx.navigation:navigation-ui-ktx:2.8.3'
  implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
  kapt 'com.google.dagger:dagger-compiler:2.53.1'
  kapt 'com.google.dagger:dagger-android-processor:2.53.1'
  testImplementation 'junit:junit:4.13.2'
  androidTestImplementation 'androidx.test.ext:junit:1.2.1'
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
  implementation 'com.google.android.flexbox:flexbox:3.0.0'
  implementation "androidx.constraintlayout:constraintlayout:2.1.4"

  // define a BOM and its version
  implementation(platform("com.squareup.okhttp3:okhttp-bom:4.11.0"))
  implementation("com.squareup.okhttp3:okhttp")
}
