pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
    repositories {
        google()
        mavenCentral()

        // For React Native < 0.71 (Old Architecture/Legacy)
        // If you support older versions, you might need to point to local node_modules
        maven {
            url(new File(rootDir, "../node_modules/react-native/android"))
        }
    }
}

rootProject.name = "Olo Pay React Native (SDK)"

// Tells Gradle where to find the React Native Gradle Plugin.
// Needed to allow this standalone SDK project to compile without being part
// of a React Native app.
def rnPluginPath = new File(rootDir, "../node_modules/@react-native/gradle-plugin")
if (rnPluginPath.exists()) {
    includeBuild(rnPluginPath)
} else {
    // Fallback for older RN versions or weird structures
    def legacyPluginPath = new File(rootDir, "../node_modules/react-native-gradle-plugin")
    if (legacyPluginPath.exists()) {
        includeBuild(legacyPluginPath)
    }
}