/** Android permissions the MetoYou Capacitor shell must declare for voice, camera, and notifications. */
export const ANDROID_REQUIRED_MANIFEST_PERMISSIONS = [
  'android.permission.INTERNET',
  'android.permission.POST_NOTIFICATIONS',
  'android.permission.RECORD_AUDIO',
  'android.permission.MODIFY_AUDIO_SETTINGS',
  'android.permission.CAMERA',
  'android.permission.FOREGROUND_SERVICE',
  'android.permission.FOREGROUND_SERVICE_MICROPHONE',
  'android.permission.WAKE_LOCK',
  'android.permission.BLUETOOTH_CONNECT'
] as const;

/** Return manifest permission names that are missing from the given AndroidManifest.xml source. */
export function findMissingAndroidManifestPermissions(
  manifestXml: string,
  requiredPermissions: readonly string[] = ANDROID_REQUIRED_MANIFEST_PERMISSIONS
): string[] {
  return requiredPermissions.filter((permission) => !manifestXml.includes(`android:name="${permission}"`));
}
