apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

android {
  compileSdk 33

  defaultConfig {
    applicationId "ru.gaket.themoviedb"
    minSdk 26
    targetSdk 33
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  }

  buildTypes {
    release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    debug {
      buildConfigField "String", "BASE_URL", "\"https://api.themoviedb.org/3/\""
      buildConfigField "String", "BASE_IMAGE_URL", "\"https://image.tmdb.org/t/p/w300\""

      // If you decide to play with this app more than a few times,
      // please, create your own api key, so this one does not get banned:
      // https://www.themoviedb.org/documentation/api
      buildConfigField "String", "API_KEY", "\"c058d9a291e7f1dd69f97f1afac69b61\""
    }
  }

  viewBinding {
    enabled = true
  }

  kotlinOptions {
    freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.FlowPreview"
    freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
    freeCompilerArgs += "-Xopt-in=kotlin.contracts.ExperimentalContracts"
  }
}

ext {
  versions = [
    retrofit        : "2.9.0",
    gson            : "2.9.0",
    glide           : "4.6.1",
    kotlinExt       : "2.4.1",
    kotlinCoroutines: "1.6.1",
  ]
}

dependencies {
  implementation project(':base-aac')
  implementation project(':runtime-coroutines')
  implementation project(':tools')

  implementation platform('com.google.firebase:firebase-bom:29.0.2')
  implementation 'com.google.firebase:firebase-analytics-ktx'
  implementation 'com.google.firebase:firebase-crashlytics-ktx'

  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'androidx.appcompat:appcompat:1.6.0'
  implementation 'androidx.core:core-ktx:1.9.0'
  implementation "androidx.fragment:fragment-ktx:1.5.5"
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$versions.kotlinCoroutines"
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.kotlinCoroutines"
  implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
  implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.kotlinExt"
  implementation "androidx.lifecycle:lifecycle-runtime-ktx:$versions.kotlinExt"
  implementation "androidx.lifecycle:lifecycle-livedata-ktx:$versions.kotlinExt"
  implementation "com.squareup.retrofit2:retrofit:$versions.retrofit"
  implementation "com.squareup.retrofit2:converter-gson:$versions.retrofit"
  implementation "androidx.recyclerview:recyclerview:1.2.1"
  implementation 'com.squareup.picasso:picasso:2.71828'
  implementation "com.google.code.gson:gson:$versions.gson"
  implementation 'jp.wasabeef:picasso-transformations:2.4.0'
  implementation 'com.jakewharton.timber:timber:5.0.1'

  testImplementation 'junit:junit:4.13.2'
  testImplementation "org.assertj:assertj-core:3.22.0"
  androidTestImplementation 'androidx.test.ext:junit:1.1.5'
  androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
