<?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/nav_graph"
    app:startDestination="@id/loginFragment">

    <!-- 登录页Fragment -->
    <fragment
        android:id="@+id/loginFragment"
        android:name="com.narutohuo.xindazhou.common.auth.ui.LoginFragment"
        android:label="登录"
        tools:layout="@layout/fragment_login">
        
        <!-- 登录成功后导航到主界面 -->
        <action
            android:id="@+id/action_loginFragment_to_mainFragment"
            app:destination="@id/mainFragment"
            app:popUpTo="@id/loginFragment"
            app:popUpToInclusive="true" />
        
        <!-- 跳转到注册页 -->
        <action
            android:id="@+id/action_loginFragment_to_registerFragment"
            app:destination="@id/registerFragment" />
    </fragment>

    <!-- 注册页Fragment -->
    <fragment
        android:id="@+id/registerFragment"
        android:name="com.narutohuo.xindazhou.common.auth.ui.RegisterFragment"
        android:label="注册"
        tools:layout="@layout/fragment_register">
        
        <!-- 注册成功后返回登录页 -->
        <action
            android:id="@+id/action_registerFragment_to_loginFragment"
            app:destination="@id/loginFragment"
            app:popUpTo="@id/registerFragment"
            app:popUpToInclusive="true" />
        
        <!-- 注册成功后直接进入主界面（可选） -->
        <action
            android:id="@+id/action_registerFragment_to_mainFragment"
            app:destination="@id/mainFragment"
            app:popUpTo="@id/loginFragment"
            app:popUpToInclusive="true" />
    </fragment>

    <!-- 主界面Fragment -->
    <!-- 包含底部导航栏（TabBar）和各个业务模块的Fragment容器 -->
    <fragment
        android:id="@+id/mainFragment"
        android:name="com.narutohuo.xindazhou.main.ui.MainFragment"
        android:label="主界面"
        tools:layout="@layout/fragment_main" />

</navigation>

