<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <!-- Network & Sync Permissions -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    
    <!-- Notifications -->
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    
    <!-- Battery Optimization (for WorkManager background sync) -->
    <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
    
    <!-- BOOT Permission - CRITICAL für Auto-Sync nach Neustart! -->
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

    <application
        android:name=".SimpleNotesApplication"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:localeConfig="@xml/locales_config"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.SimpleNotes"
        android:networkSecurityConfig="@xml/network_security_config"
        tools:targetApi="31">
        <!-- MainActivity v1.5.0 (Jetpack Compose) - Launcher -->
        <activity
            android:name=".ui.main.ComposeMainActivity"
            android:exported="true"
            android:theme="@style/Theme.SimpleNotes.Splash">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- Legacy MainActivity (XML-based) - kept for reference -->
        <activity
            android:name=".MainActivity"
            android:exported="false"
            android:theme="@style/Theme.SimpleNotes" />

        <!-- Editor Activity (Legacy - XML-based) -->
        <activity
            android:name=".NoteEditorActivity"
            android:windowSoftInputMode="adjustResize"
            android:parentActivityName=".ui.main.ComposeMainActivity" />

        <!-- Editor Activity v1.5.0 (Jetpack Compose) -->
        <activity
            android:name=".ui.editor.ComposeNoteEditorActivity"
            android:windowSoftInputMode="adjustResize"
            android:parentActivityName=".ui.main.ComposeMainActivity"
            android:theme="@style/Theme.SimpleNotes" />

        <!-- Settings Activity (Legacy - XML-based) -->
        <activity
            android:name=".SettingsActivity"
            android:parentActivityName=".ui.main.ComposeMainActivity" />

        <!-- Settings Activity v1.5.0 (Jetpack Compose) -->
        <activity
            android:name=".ui.settings.ComposeSettingsActivity"
            android:parentActivityName=".ui.main.ComposeMainActivity"
            android:theme="@style/Theme.SimpleNotes" />

        <!-- Boot Receiver - Startet WorkManager nach Reboot -->
        <receiver
            android:name=".sync.BootReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>

        <!-- FileProvider für Log-Sharing -->
        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths" />
        </provider>

    </application>

</manifest>