<?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_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" />

    </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" />

    </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">

        <action
            android:id="@+id/action_countrySelected"
            app:popUpTo="@id/countryPickerFragment"
            app:popUpToInclusive="true" />

    </fragment>

    <fragment
        android:id="@+id/enterCodeFragment"
        android:name="org.thoughtcrime.securesms.registration.fragments.EnterCodeFragment"
        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_wrongNumber"
            app:popUpTo="@id/enterCodeFragment"
            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" />

        <argument
            android:name="isV1RegistrationLock"
            app:argType="boolean" />

    </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">

        <action
            android:id="@+id/action_captchaComplete"
            app:popUpTo="@id/captchaFragment"
            app:popUpToInclusive="true" />

    </fragment>

    <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 app:nullable="true"
                  app:argType="android.net.Uri"
                  android:defaultValue="@null"
                  android:name="uri" />

    </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" />

</navigation>