<?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/mobile_navigation"
    app:startDestination="@+id/navigation_home">

    <fragment
        android:id="@+id/navigation_login"
        android:name="com.kbs.kbsintranett.LoginFragment"
        android:label="Logg inn"
        tools:layout="@layout/fragment_login">
        <action
            android:id="@+id/action_login_to_home"
            app:destination="@id/navigation_home"
            app:popUpTo="@id/navigation_home"
            app:popUpToInclusive="true" />
    </fragment>

    <fragment
        android:id="@+id/navigation_home"
        android:name="com.kbs.kbsintranett.HomeFragment"
        android:label="Hjem"
        tools:layout="@layout/fragment_home">
        <action
            android:id="@+id/action_home_to_calendarFull"
            app:destination="@id/navigation_calendar_full" />
        <action
            android:id="@+id/action_home_to_newsFull"
            app:destination="@id/navigation_news_full" />
        <action
            android:id="@+id/action_home_to_newsDetail"
            app:destination="@id/navigation_news_detail" />
        <!-- HER ER DEN MANGLENDE LINKEN: -->
        <action
            android:id="@+id/action_home_to_create_event"
            app:destination="@id/navigation_create_event" />
    </fragment>

    <!-- NYTT FRAGMENT: Opprett hendelse -->
    <fragment
        android:id="@+id/navigation_create_event"
        android:name="com.kbs.kbsintranett.CreateEventFragment"
        android:label="Ny Hendelse"
        tools:layout="@layout/fragment_create_event" />

    <fragment
        android:id="@+id/navigation_calendar_full"
        android:name="com.kbs.kbsintranett.CalendarFullFragment"
        android:label="Kalender"
        tools:layout="@layout/fragment_calendar_full" />

    <fragment
        android:id="@+id/navigation_news_full"
        android:name="com.kbs.kbsintranett.NewsFullFragment"
        android:label="Nyheter"
        tools:layout="@layout/fragment_news_full">
        <action
            android:id="@+id/action_newsFull_to_newsDetail"
            app:destination="@id/navigation_news_detail" />
    </fragment>

    <fragment
        android:id="@+id/navigation_news_detail"
        android:name="com.kbs.kbsintranett.NewsDetailFragment"
        android:label="Nyhet"
        tools:layout="@layout/fragment_news_detail" />

    <fragment
        android:id="@+id/navigation_forms"
        android:name="com.kbs.kbsintranett.FormsListFragment"
        android:label="Skjemaer"
        tools:layout="@layout/fragment_forms_list">
        <action
            android:id="@+id/action_formsListFragment_to_formsDetailFragment"
            app:destination="@id/navigation_forms_detail" />
    </fragment>

    <fragment
        android:id="@+id/navigation_forms_detail"
        android:name="com.kbs.kbsintranett.FormsFragment"
        android:label="Fyll ut skjema"
        tools:layout="@layout/fragment_forms">
        <argument
            android:name="formId"
            app:argType="integer"
            android:defaultValue="0" />
    </fragment>

    <fragment
        android:id="@+id/navigation_handbook"
        android:name="com.kbs.kbsintranett.HandbookFragment"
        android:label="Håndbok"
        tools:layout="@layout/fragment_handbook">
        <action
            android:id="@+id/action_handbook_to_detail"
            app:destination="@id/navigation_handbook_detail" />
    </fragment>

    <fragment
        android:id="@+id/navigation_handbook_detail"
        android:name="com.kbs.kbsintranett.HandbookDetailFragment"
        android:label="Håndbok Detaljer"
        tools:layout="@layout/fragment_handbook_detail">
        <argument
            android:name="page_id"
            app:argType="integer" />
        <argument
            android:name="page_title"
            app:argType="string" />

        <action
            android:id="@+id/action_handbook_to_detail"
            app:destination="@id/navigation_handbook_detail" />

        <action
            android:id="@+id/action_handbook_to_form"
            app:destination="@id/navigation_forms_detail" />
    </fragment>

    <fragment
        android:id="@+id/navigation_profile"
        android:name="com.kbs.kbsintranett.ProfileFragment"
        android:label="Min Profil"
        tools:layout="@layout/fragment_profile">
        <action
            android:id="@+id/action_profile_to_login"
            app:destination="@id/navigation_login"
            app:popUpTo="@id/navigation_home"
            app:popUpToInclusive="true" />
        <action
            android:id="@+id/action_profile_to_form"
            app:destination="@id/navigation_forms_detail" />
    </fragment>

</navigation>