"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectAndroidProject = detectAndroidProject;
exports.detectAndroidLanguage = detectAndroidLanguage;
const fast_glob_1 = __importDefault(require("fast-glob"));
/**
 * Returns true when the directory contains an Android project.
 * Primary signal: AndroidManifest.xml (Android-specific; not present in pure JVM projects).
 */
async function detectAndroidProject(options) {
    const manifests = await (0, fast_glob_1.default)('**/AndroidManifest.xml', {
        cwd: options.installDir,
        ignore: ['**/node_modules/**', '**/build/**', '**/.gradle/**'],
        deep: 6,
    });
    return manifests.length > 0;
}
/**
 * Returns the primary language used in the Android project.
 * Presence of any .kt source file → Kotlin; otherwise assumes Java.
 */
async function detectAndroidLanguage(options) {
    const kotlinFiles = await (0, fast_glob_1.default)('**/*.kt', {
        cwd: options.installDir,
        ignore: ['**/node_modules/**', '**/build/**', '**/.gradle/**'],
        deep: 8,
    });
    return kotlinFiles.length > 0 ? 'kotlin' : 'java';
}
