plugins {
    id 'com.android.application'
}

android {
    namespace 'com.pediatricscribe.twa'
    compileSdk 34

    defaultConfig {
        applicationId "com.pediatricscribe.twa"
        minSdk 24
        targetSdk 34
        versionCode 1
        versionName "1.0.0"

        // TWA host URL — default: peds.danvics.com (change if self-hosting elsewhere)
        def twaHost = project.hasProperty('TWA_HOST') ? project.property('TWA_HOST') : "peds.danvics.com"
        def twaUrl = "https://${twaHost}"
        manifestPlaceholders = [
            hostName: twaHost,
            defaultUrl: twaUrl,
            launcherName: "PedScribe",
            assetStatements: "[{ \"relation\": [\"delegate_permission/common.handle_all_urls\"], \"target\": { \"namespace\": \"web\", \"site\": \"${twaUrl}\" } }]"
        ]
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
        }
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'androidx.browser:browser:1.7.0'
    implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.5.0'
}
