<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/signup"
    app:startDestination="@id/welcomeFragment">

    <fragment
        android:id="@+id/welcomeFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.WelcomeFragment"
        android:label="fragment_welcome"
        tools:layout="@layout/fragment_registration_welcome">

        <action
            android:id="@+id/action_restore"
            app:destination="@id/restoreBackupFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_skip_restore"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_transfer_or_restore"
            app:destination="@id/transferOrRestore"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_welcomeFragment_to_deviceTransferSetup"
            app:destination="@id/deviceTransferSetup"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

    </fragment>

    <fragment
        android:id="@+id/chooseBackupFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.ChooseBackupFragment"
        android:label="fragment_choose_backup"
        tools:layout="@layout/fragment_registration_choose_backup">

        <action
            android:id="@+id/action_restore"
            app:destination="@id/restoreBackupFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@id/chooseBackupFragment"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/action_skip"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/slide_from_end"
            app:exitAnim="@anim/slide_to_start"
            app:popEnterAnim="@anim/slide_from_start"
            app:popExitAnim="@anim/slide_to_end" />

    </fragment>

    <fragment
        android:id="@+id/enterPhoneNumberFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.EnterPhoneNumberFragment"
        android:label="fragment_enter_phone_number"
        tools:layout="@layout/fragment_registration_enter_phone_number">

        <action
            android:id="@+id/action_pickCountry"
            app:destination="@id/countryPickerFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:launchSingleTop="true"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_enterVerificationCode"
            app:destination="@id/enterCodeFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_requestCaptcha"
            app:destination="@id/captchaFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_editProxy"
            app:destination="@+id/registrationProxyFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

    </fragment>

    <fragment
        android:id="@+id/countryPickerFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.CountryPickerFragment"
        android:label="fragment_country_picker"
        tools:layout="@layout/fragment_registration_country_picker"/>

    <fragment
        android:id="@+id/enterCodeFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.EnterSmsCodeFragment"
        android:label="fragment_enter_code"
        tools:layout="@layout/fragment_registration_enter_code">

        <action
            android:id="@+id/action_requireKbsLockPin"
            app:destination="@id/registrationLockFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@+id/welcomeFragment"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/action_requestCaptcha"
            app:destination="@id/captchaFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_successfulRegistration"
            app:destination="@id/registrationCompletePlaceHolderFragment"
            app:popUpTo="@+id/welcomeFragment"
            app:popUpToInclusive="true" />
        <action
            android:id="@+id/action_accountLocked"
            app:destination="@id/accountLockedFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@+id/welcomeFragment"
            app:popUpToInclusive="true" />

    </fragment>

    <fragment
        android:id="@+id/registrationLockFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.RegistrationLockFragment"
        android:label="fragment_kbs_lock"
        tools:layout="@layout/fragment_registration_lock">

        <action
            android:id="@+id/action_successfulRegistration"
            app:destination="@id/registrationCompletePlaceHolderFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@+id/welcomeFragment"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/action_accountLocked"
            app:destination="@id/accountLockedFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@+id/welcomeFragment"
            app:popUpToInclusive="true" />

        <argument
            android:name="timeRemaining"
            app:argType="long" />

    </fragment>

    <fragment
        android:id="@+id/accountLockedFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.AccountLockedFragment"
        android:label="fragment_account_locked"
        tools:layout="@layout/account_locked_fragment" />

    <fragment
        android:id="@+id/captchaFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.CaptchaFragment"
        android:label="fragment_captcha"
        tools:layout="@layout/fragment_registration_captcha"/>

    <fragment
        android:id="@+id/restoreBackupFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.RestoreBackupFragment"
        android:label="fragment_restore_backup"
        tools:layout="@layout/fragment_registration_restore_backup">

        <action
            android:id="@+id/action_backupRestored"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@id/restoreBackupFragment"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/action_skip"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/slide_from_end"
            app:exitAnim="@anim/slide_to_start"
            app:popEnterAnim="@anim/slide_from_start"
            app:popExitAnim="@anim/slide_to_end" />

        <action
            android:id="@+id/action_noBackupFound"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@id/restoreBackupFragment"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/action_skip_no_return"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@+id/restoreBackupFragment"
            app:popUpToInclusive="true" />

        <argument
            android:name="uri"
            android:defaultValue="@null"
            app:argType="android.net.Uri"
            app:nullable="true" />

    </fragment>

    <fragment
        android:id="@+id/registrationCompletePlaceHolderFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.RegistrationCompleteFragment"
        android:label="fragment_registration_complete_place_holder"
        tools:layout="@layout/fragment_registration_blank" />

    <fragment
        android:id="@+id/registrationProxyFragment"
        android:name="org.thoughtcrime.securesms.preferences.EditProxyFragment"
        android:label="fragment_registration_edit_proxy"
        tools:layout="@layout/edit_proxy_fragment" />

    <fragment
        android:id="@+id/transferOrRestore"
        android:name="org.thoughtcrime.securesms.devicetransfer.newdevice.TransferOrRestoreFragment"
        tools:layout="@layout/fragment_transfer_restore">

        <action
            android:id="@+id/action_choose_backup"
            app:destination="@id/chooseBackupFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_new_device_transfer_instructions"
            app:destination="@id/newDeviceTransferInstructions"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

    </fragment>

    <fragment
        android:id="@+id/newDeviceTransferInstructions"
        android:name="org.thoughtcrime.securesms.devicetransfer.newdevice.NewDeviceTransferInstructionsFragment"
        tools:layout="@layout/new_device_transfer_instructions_fragment">

        <action
            android:id="@+id/action_device_transfer_setup"
            app:destination="@id/deviceTransferSetup"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

    </fragment>

    <fragment
        android:id="@+id/deviceTransferSetup"
        android:name="org.thoughtcrime.securesms.devicetransfer.newdevice.NewDeviceTransferSetupFragment"
        tools:layout="@layout/device_transfer_setup_fragment">

        <action
            android:id="@+id/action_new_device_transfer"
            app:destination="@id/newDeviceTransfer"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

        <action
            android:id="@+id/action_deviceTransferSetup_to_transferOrRestore"
            app:destination="@id/transferOrRestore"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@id/transferOrRestore"
            app:popUpToInclusive="true" />

    </fragment>

    <fragment
        android:id="@+id/newDeviceTransfer"
        android:name="org.thoughtcrime.securesms.devicetransfer.newdevice.NewDeviceTransferFragment"
        tools:layout="@layout/device_transfer_fragment">

        <action
            android:id="@+id/action_newDeviceTransfer_to_newDeviceTransferInstructions"
            app:destination="@id/newDeviceTransferInstructions"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@id/newDeviceTransferInstructions"
            app:popUpToInclusive="true" />

        <action
            android:id="@+id/action_newDeviceTransfer_to_newDeviceTransferComplete"
            app:destination="@id/newDeviceTransferComplete"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim"
            app:popUpTo="@id/welcomeFragment" />

    </fragment>

    <fragment
        android:id="@+id/newDeviceTransferComplete"
        android:name="org.thoughtcrime.securesms.devicetransfer.newdevice.NewDeviceTransferCompleteFragment"
        tools:layout="@layout/new_device_transfer_complete_fragment">

        <action
            android:id="@+id/action_newDeviceTransferComplete_to_enterPhoneNumberFragment"
            app:destination="@id/enterPhoneNumberFragment"
            app:enterAnim="@anim/nav_default_enter_anim"
            app:exitAnim="@anim/nav_default_exit_anim"
            app:popEnterAnim="@anim/nav_default_pop_enter_anim"
            app:popExitAnim="@anim/nav_default_pop_exit_anim" />

    </fragment>

    <action
        android:id="@+id/action_restart_to_welcomeFragment"
        app:destination="@id/welcomeFragment"
        app:enterAnim="@anim/nav_default_enter_anim"
        app:exitAnim="@anim/nav_default_exit_anim"
        app:popEnterAnim="@anim/nav_default_pop_enter_anim"
        app:popExitAnim="@anim/nav_default_pop_exit_anim"
        app:popUpTo="@id/welcomeFragment"
        app:popUpToInclusive="true" />

</navigation>