<?php

use App\Http\Controllers\Auth\RegisteredUserController;
use App\Http\Controllers\Member\DashboardController;
use App\Http\Controllers\Member\CaseController as MemberCaseController;
use App\Http\Controllers\Member\CvController;
use App\Http\Controllers\Member\JobController;
use App\Http\Controllers\Member\ForumController;
use App\Http\Controllers\Member\ShareKnowledgeController;
use App\Http\Controllers\Member\FreelanceController;
use App\Http\Controllers\Member\SurveyController;
use App\Http\Controllers\Member\ProfileController;
use App\Http\Controllers\Admin\AdminCaseController;
use App\Http\Controllers\Admin\DashboardController as AdminDashboardController;
use App\Http\Controllers\Admin\UserController as AdminUserController;
use App\Http\Controllers\PublicSurveyController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

// ══════════════════════════════════════════════════════════════════
//  InPractice — Main Route File
//
//  Structure:
//    /                  → redirects to login
//    /onboarding/*      → theme picker (before registration)
//    /admin/*           → admin routes (EnsureAdmin middleware)
//    /app/*             → member routes (EnsureMember middleware)
//    auth.php           → login, register, password reset (Breeze)
//
//  Build status:
//    Step 6  ✅ Layouts
//    Step 7  ✅ Auth pages (Login, Register)
//    Step 8  ✅ Member Dashboard
//    Step 9  ✅ Case Library
//    Step 9b ✅ Member Solutions & Ratings
//    Step 10 ✅ Admin Panel
//    Step 11 ✅ Ask Members 4 Opinion (Forum)
//    Step 13 ✅ Job Club (CV Pool + Job Listings)
//    Step 14 ✅ Help & Earn (Freelance)
//    Step 15 ✅ Surveys
// ══════════════════════════════════════════════════════════════════

// ── Root → Login or app (avoids redirect loops for logged-in users) ──
Route::get('/', function () {
    if (auth()->check()) {
        $user = auth()->user();

        if ($user->isAdmin()) {
            return redirect()->route('admin.dashboard');
        }

        if (! $user->hasVerifiedEmail()) {
            return redirect()->route('verification.notice');
        }

        return redirect()->route('member.dashboard');
    }

    return redirect()->route('login');
})->name('home');

// ── Onboarding — Theme Picker ──────────────────────────────────
// Shown before registration — no auth required
Route::get('/onboarding/theme', function () {
    return Inertia::render('Onboarding/ThemePicker');
})->name('onboarding.theme');

// ── Public Survey Link — no auth required ──────────────────────
// Anyone with the token URL can view and respond.
// GET  /s/{token}  → show the survey
// POST /s/{token}  → submit a response
Route::get('/s/{token}',  [PublicSurveyController::class, 'show'])
    ->name('survey.public.show');

Route::post('/s/{token}', [PublicSurveyController::class, 'respond'])
    ->name('survey.public.respond');

// ── Register — override Breeze default with our controller ─────
Route::post('/register', [RegisteredUserController::class, 'store'])
    ->name('register.store');

// ══════════════════════════════════════════════════════════════════
//  ADMIN ROUTES
//  Prefix: /admin
//  Name:   admin.*
//  Guard:  auth + verified + admin middleware
// ══════════════════════════════════════════════════════════════════
Route::middleware(['auth', 'verified', 'admin'])
    ->prefix('admin')
    ->name('admin.')
    ->group(function () {

        // ── Step 10a: Admin Dashboard ──────────────────────────
        // admin.dashboard   GET   /admin/dashboard
        Route::get('/dashboard', [AdminDashboardController::class, 'index'])
            ->name('dashboard');

        // ── Step 9: Case Library (admin) ───────────────────────
        // admin.cases.index   GET    /admin/cases
        // admin.cases.create  GET    /admin/cases/create
        // admin.cases.store   POST   /admin/cases
        // admin.cases.edit    GET    /admin/cases/{case}/edit
        // admin.cases.update  PUT    /admin/cases/{case}
        // admin.cases.destroy DELETE /admin/cases/{case}
        Route::resource('cases', AdminCaseController::class)
            ->only(['index', 'create', 'store', 'edit', 'update', 'destroy']);

        // Publish / Archive — separate PATCH actions (not CRUD)
        Route::patch('/cases/{case}/publish', [AdminCaseController::class, 'publish'])
            ->name('cases.publish');
        Route::patch('/cases/{case}/archive', [AdminCaseController::class, 'archive'])
            ->name('cases.archive');

        // ── Step 10b: User Management ──────────────────────────
        // admin.users.index          GET   /admin/users
        // admin.users.toggle-active  PATCH /admin/users/{user}/toggle-active
        Route::get('/users', [AdminUserController::class, 'index'])
            ->name('users.index');
        Route::patch('/users/{user}/toggle-active', [AdminUserController::class, 'toggleActive'])
            ->name('users.toggle-active');

    });

// ══════════════════════════════════════════════════════════════════
//  MEMBER ROUTES
//  Prefix: /app
//  Name:   member.*
//  Guard:  auth + verified + member middleware
// ══════════════════════════════════════════════════════════════════
Route::middleware(['auth', 'verified', 'member'])
    ->prefix('app')
    ->name('member.')
    ->group(function () {

        // ── Dashboard ──────────────────────────────────────────
        Route::get('/dashboard', [DashboardController::class, 'index'])
            ->name('dashboard');

        // ── User Preferences ───────────────────────────────────
        // Called by useAuthStore when theme or locale toggle is used.
        // PATCH so it's idempotent and doesn't pollute browser history.
        Route::patch('/preferences/theme', function (Request $request) {
            $request->validate([
                'theme' => ['required', 'string', 'in:navy,dark'],
            ]);

            $request->user()->update(['theme' => $request->theme]);

            return back();
        })->name('preferences.theme');

        Route::patch('/preferences/locale', function (Request $request) {
            $request->validate([
                'locale' => ['required', 'string', 'in:en,ar'],
            ]);

            $request->user()->update(['language' => $request->locale]);

            return back();
        })->name('preferences.locale');

        // ── Notifications ──────────────────────────────────────
        // Called by useNotificationStore when bell is opened.
        Route::patch('/notifications/read-all', function (Request $request) {
            $request->user()
                    ->notifications()
                    ->whereNull('read_at')
                    ->update(['read_at' => now()]);

            return back();
        })->name('notifications.read-all');

        // ── Step 9: Case Library (member) ──────────────────────
        // member.cases.index    GET   /app/cases
        // member.cases.show     GET   /app/cases/{case}
        Route::get('/cases', [MemberCaseController::class, 'index'])
            ->name('cases.index');

        // Progress tracker — must be BEFORE {case} to avoid conflict
        Route::get('/cases/progress', [MemberCaseController::class, 'progress'])
            ->name('cases.progress');

        Route::get('/cases/{case}', [MemberCaseController::class, 'show'])
            ->name('cases.show');

        // Reveal solution — PATCH (idempotent, marks solution_revealed = true)
        Route::patch('/cases/{case}/reveal', [MemberCaseController::class, 'reveal'])
            ->name('cases.reveal');

        // Mark complete — PATCH
        Route::patch('/cases/{case}/complete', [MemberCaseController::class, 'complete'])
            ->name('cases.complete');

        // Rate InPractice solution — PATCH
        Route::patch('/cases/{case}/rate', [MemberCaseController::class, 'rateCase'])
            ->name('cases.rate');

        // ── Member Solutions ───────────────────────────────────
        // member.cases.solutions.store        POST    /app/cases/{case}/solutions
        // member.cases.solutions.update       PATCH   /app/cases/{case}/solutions/{solution}
        // member.cases.solutions.rating-count GET     /app/cases/{case}/solutions/{solution}/rating-count
        // member.cases.solutions.destroy      DELETE  /app/cases/{case}/solutions/{solution}
        // member.cases.solutions.rate         PATCH   /app/cases/{case}/solutions/{solution}/rate
        Route::post('/cases/{case}/solutions', [MemberCaseController::class, 'storeSolution'])
            ->name('cases.solutions.store');

        Route::patch('/cases/{case}/solutions/{solution}', [MemberCaseController::class, 'updateSolution'])
            ->name('cases.solutions.update');

        Route::get('/cases/{case}/solutions/{solution}/rating-count', [MemberCaseController::class, 'solutionRatingCount'])
            ->name('cases.solutions.rating-count');

        Route::delete('/cases/{case}/solutions/{solution}', [MemberCaseController::class, 'deleteSolution'])
            ->name('cases.solutions.destroy');

        Route::patch('/cases/{case}/solutions/{solution}/rate', [MemberCaseController::class, 'rateSolution'])
            ->name('cases.solutions.rate');

        // ── Step 11: Ask Members 4 Opinion (Forum) ────────────
        // member.forum.index         GET    /app/forum
        // member.forum.create        GET    /app/forum/create
        // member.forum.store         POST   /app/forum
        // member.forum.show          GET    /app/forum/{post}
        // member.forum.update        PATCH  /app/forum/{post}
        // member.forum.destroy       DELETE /app/forum/{post}
        // member.forum.close         PATCH  /app/forum/{post}/close
        // member.forum.reply.store   POST   /app/forum/{post}/replies
        // member.forum.reply.update  PATCH  /app/forum/{post}/replies/{reply}
        // member.forum.reply.destroy DELETE /app/forum/{post}/replies/{reply}
        // member.forum.post.like     POST   /app/forum/{post}/like
        // member.forum.reply.like    POST   /app/forum/{post}/replies/{reply}/like
        // member.forum.reply.rate    PATCH  /app/forum/{post}/replies/{reply}/rate
        // member.forum.best-answer   PATCH  /app/forum/{post}/best-answer/{reply}

        // create must be BEFORE {post} to avoid route conflict
        Route::get('/forum', [ForumController::class, 'index'])
            ->name('forum.index');

        Route::get('/forum/create', [ForumController::class, 'create'])
            ->name('forum.create');

        Route::post('/forum', [ForumController::class, 'store'])
            ->name('forum.store');

        Route::get('/forum/{post}', [ForumController::class, 'show'])
            ->name('forum.show');

        Route::patch('/forum/{post}', [ForumController::class, 'update'])
            ->name('forum.update');

        Route::delete('/forum/{post}', [ForumController::class, 'destroy'])
            ->name('forum.destroy');

        Route::patch('/forum/{post}/close', [ForumController::class, 'close'])
            ->name('forum.close');

        // Replies
        Route::post('/forum/{post}/replies', [ForumController::class, 'storeReply'])
            ->name('forum.reply.store');

        Route::patch('/forum/{post}/replies/{reply}', [ForumController::class, 'updateReply'])
            ->name('forum.reply.update');

        Route::delete('/forum/{post}/replies/{reply}', [ForumController::class, 'destroyReply'])
            ->name('forum.reply.destroy');

        // Likes — JSON, no page reload
        Route::post('/forum/{post}/like', [ForumController::class, 'likePost'])
            ->name('forum.post.like');

        Route::post('/forum/{post}/replies/{reply}/like', [ForumController::class, 'likeReply'])
            ->name('forum.reply.like');

        // Rate reply — JSON
        Route::patch('/forum/{post}/replies/{reply}/rate', [ForumController::class, 'rateReply'])
            ->name('forum.reply.rate');

        // Mark best answer — JSON
        Route::patch('/forum/{post}/best-answer/{reply}', [ForumController::class, 'markBestAnswer'])
            ->name('forum.best-answer');

        // ── Step 13: Job Club ──────────────────────────────────
        // CV Pool
        // member.cv.pool        GET    /app/job-club/cv-pool
        // member.cv.profile     GET    /app/job-club/my-cv
        // member.cv.save        POST   /app/job-club/my-cv
        // member.cv.toggle      PATCH  /app/job-club/my-cv/toggle-visibility
        Route::get('/job-club/cv-pool', [CvController::class, 'pool'])
            ->name('cv.pool');

        Route::get('/job-club/my-cv', [CvController::class, 'myProfile'])
            ->name('cv.profile');

        Route::post('/job-club/my-cv', [CvController::class, 'save'])
            ->name('cv.save');

        Route::patch('/job-club/my-cv/toggle-visibility', [CvController::class, 'toggleVisibility'])
            ->name('cv.toggle');

        // Job Listings
        // member.jobs.index         GET    /app/job-club/listings
        // member.jobs.create        GET    /app/job-club/listings/create
        // member.jobs.store         POST   /app/job-club/listings
        // member.jobs.my-listings   GET    /app/job-club/my-listings
        // member.jobs.show          GET    /app/job-club/listings/{listing}
        // member.jobs.close         PATCH  /app/job-club/listings/{listing}/close
        // member.jobs.reopen        PATCH  /app/job-club/listings/{listing}/reopen
        // member.jobs.apply         POST   /app/job-club/listings/{listing}/apply
        // member.jobs.send-direct   POST   /app/job-club/cv-pool/{cv}/send/{listing}
        // member.jobs.notifications GET    /app/job-club/my-notifications
        // member.jobs.respond       PATCH  /app/job-club/notifications/{notification}/respond
        // member.jobs.consent       PATCH  /app/job-club/notifications/{notification}/consent
        // member.jobs.initiate      PATCH  /app/job-club/notifications/{notification}/initiate
        Route::get('/job-club/listings', [JobController::class, 'index'])
            ->name('jobs.index');

        // create must be BEFORE {listing} to avoid route conflict
        Route::get('/job-club/listings/create', [JobController::class, 'create'])
            ->name('jobs.create');

        Route::post('/job-club/listings', [JobController::class, 'store'])
            ->name('jobs.store');

        // my-listings must be BEFORE {listing} to avoid route conflict
        Route::get('/job-club/my-listings', [JobController::class, 'myListings'])
            ->name('jobs.my-listings');

        Route::get('/job-club/listings/{listing}', [JobController::class, 'show'])
            ->name('jobs.show');

        Route::patch('/job-club/listings/{listing}/close', [JobController::class, 'close'])
            ->name('jobs.close');

        Route::patch('/job-club/listings/{listing}/reopen', [JobController::class, 'reopen'])
            ->name('jobs.reopen');

        Route::post('/job-club/listings/{listing}/apply', [JobController::class, 'apply'])
            ->name('jobs.apply');

        // Direct send — from CV pool to a specific profile
        Route::post('/job-club/cv-pool/{cv}/send/{listing}', [JobController::class, 'sendDirect'])
            ->name('jobs.send-direct');

        // Notifications inbox for the professional side
        Route::get('/job-club/my-notifications', [JobController::class, 'notifications'])
            ->name('jobs.notifications');

        // Respond to an interest notification (accept / decline)
        Route::patch('/job-club/notifications/{notification}/respond', [JobController::class, 'respond'])
            ->name('jobs.respond');

        // Consent — either side confirms contact sharing
        Route::patch('/job-club/notifications/{notification}/consent', [JobController::class, 'consent'])
            ->name('jobs.consent');

        // Poster initiates contact with a specific applicant
        Route::patch('/job-club/notifications/{notification}/initiate', [JobController::class, 'initiate'])
            ->name('jobs.initiate');

        // ── Step 12: Share Knowledge ───────────────────────────
        // member.share.index           GET    /app/share-knowledge
        // member.share.post.create     GET    /app/share-knowledge/create-post
        // member.share.post.store      POST   /app/share-knowledge/posts
        // member.share.document.create GET    /app/share-knowledge/upload
        // member.share.document.store  POST   /app/share-knowledge/documents
        // member.share.document.show   GET    /app/share-knowledge/documents/{document}
        // member.share.document.download GET  /app/share-knowledge/documents/{document}/download
        // member.share.document.preview  GET  /app/share-knowledge/documents/{document}/preview
        // member.share.document.rate   PATCH  /app/share-knowledge/documents/{document}/rate
        // member.share.document.destroy DELETE /app/share-knowledge/documents/{document}
        // member.share.external        GET    /app/share/external

        // Landing page — combined feed
        Route::get('/share-knowledge', [ShareKnowledgeController::class, 'index'])
            ->name('share.index');

        // Text post — create + store
        Route::get('/share-knowledge/create-post', [ShareKnowledgeController::class, 'createPost'])
            ->name('share.post.create');

        Route::post('/share-knowledge/posts', [ShareKnowledgeController::class, 'storePost'])
            ->name('share.post.store');

        // PDF upload — create + store
        Route::get('/share-knowledge/upload', [ShareKnowledgeController::class, 'createDocument'])
            ->name('share.document.create');

        Route::post('/share-knowledge/documents', [ShareKnowledgeController::class, 'storeDocument'])
            ->name('share.document.store');

        // Document show + download + preview + rate + destroy
        // Named routes must come BEFORE {document} wildcard
        Route::get('/share-knowledge/documents/{document}', [ShareKnowledgeController::class, 'showDocument'])
            ->name('share.document.show');

        Route::get('/share-knowledge/documents/{document}/download', [ShareKnowledgeController::class, 'download'])
            ->name('share.document.download');

        Route::get('/share-knowledge/documents/{document}/preview', [ShareKnowledgeController::class, 'preview'])
            ->name('share.document.preview');

        Route::patch('/share-knowledge/documents/{document}/rate', [ShareKnowledgeController::class, 'rate'])
            ->name('share.document.rate');

        Route::delete('/share-knowledge/documents/{document}', [ShareKnowledgeController::class, 'destroyDocument'])
            ->name('share.document.destroy');

        // External link warning page — ALL external URLs go through here
        Route::get('/share/external', [ShareKnowledgeController::class, 'externalRedirect'])
            ->name('share.external');

        // ── Step 14: Help & Earn (Freelance) ───────────────────
        // member.freelance.index               GET    /app/help-earn
        // member.freelance.profile.create      GET    /app/help-earn/profile/create
        // member.freelance.profile.store       POST   /app/help-earn/profile
        // member.freelance.profile.edit        GET    /app/help-earn/profile/edit
        // member.freelance.profile.update      PUT    /app/help-earn/profile/{profile}
        // member.freelance.profile.toggle      PATCH  /app/help-earn/profile/{profile}/toggle
        // member.freelance.profile.show        GET    /app/help-earn/profiles/{profile}
        // member.freelance.briefs.create       GET    /app/help-earn/briefs/create
        // member.freelance.briefs.store        POST   /app/help-earn/briefs
        // member.freelance.briefs.show         GET    /app/help-earn/briefs/{brief}
        // member.freelance.briefs.close        PATCH  /app/help-earn/briefs/{brief}/close
        // member.freelance.interest            POST   /app/help-earn/profiles/{profile}/interest
        // member.freelance.respond             PATCH  /app/help-earn/matches/{match}/respond
        // member.freelance.consent             PATCH  /app/help-earn/matches/{match}/consent
        // member.freelance.my-matches          GET    /app/help-earn/my-matches
        // member.freelance.review              POST   /app/help-earn/matches/{match}/review

        // Landing page
        Route::get('/help-earn', [FreelanceController::class, 'index'])
            ->name('freelance.index');

        // Profile — create must come BEFORE {profile} to avoid route conflict
        Route::get('/help-earn/profile/create', [FreelanceController::class, 'createProfile'])
            ->name('freelance.profile.create');

        Route::post('/help-earn/profile', [FreelanceController::class, 'storeProfile'])
            ->name('freelance.profile.store');

        Route::get('/help-earn/profile/edit', [FreelanceController::class, 'editProfile'])
            ->name('freelance.profile.edit');

        Route::put('/help-earn/profile/{profile}', [FreelanceController::class, 'updateProfile'])
            ->name('freelance.profile.update');

        Route::patch('/help-earn/profile/{profile}/toggle', [FreelanceController::class, 'toggleProfile'])
            ->name('freelance.profile.toggle');

        // Public profile — browseable by all members
        Route::get('/help-earn/profiles/{profile}', [FreelanceController::class, 'showProfile'])
            ->name('freelance.profile.show');

        // Briefs — create must come BEFORE {brief}
        Route::get('/help-earn/briefs/create', [FreelanceController::class, 'createBrief'])
            ->name('freelance.briefs.create');

        Route::post('/help-earn/briefs', [FreelanceController::class, 'storeBrief'])
            ->name('freelance.briefs.store');

        Route::get('/help-earn/briefs/{brief}', [FreelanceController::class, 'showBrief'])
            ->name('freelance.briefs.show');

        Route::patch('/help-earn/briefs/{brief}/close', [FreelanceController::class, 'closeBrief'])
            ->name('freelance.briefs.close');

        // Matching flow — JSON responses, no page reload
        Route::post('/help-earn/profiles/{profile}/interest', [FreelanceController::class, 'sendInterest'])
            ->name('freelance.interest');

        Route::patch('/help-earn/matches/{match}/respond', [FreelanceController::class, 'respond'])
            ->name('freelance.respond');

        Route::patch('/help-earn/matches/{match}/consent', [FreelanceController::class, 'consent'])
            ->name('freelance.consent');

        // My matches inbox
        Route::get('/help-earn/my-matches', [FreelanceController::class, 'myMatches'])
            ->name('freelance.my-matches');

        // Review after engagement — JSON
        Route::post('/help-earn/matches/{match}/review', [FreelanceController::class, 'storeReview'])
            ->name('freelance.review');

        // ── Step 15: Surveys ───────────────────────────────────
        // member.surveys.index         GET    /app/surveys
        // member.surveys.create        GET    /app/surveys/create
        // member.surveys.store         POST   /app/surveys
        // member.surveys.show          GET    /app/surveys/{survey}
        // member.surveys.edit          GET    /app/surveys/{survey}/edit
        // member.surveys.update        PUT    /app/surveys/{survey}
        // member.surveys.destroy       DELETE /app/surveys/{survey}
        // member.surveys.publish       PATCH  /app/surveys/{survey}/publish
        // member.surveys.toggle-status PATCH  /app/surveys/{survey}/toggle-status
        // member.surveys.respond       POST   /app/surveys/{survey}/respond
        // member.surveys.results       GET    /app/surveys/{survey}/results
        // member.surveys.bank-items.destroy DELETE /app/surveys/bank-items/{itemId}

        // Index — my surveys + open surveys feed
        Route::get('/surveys', [SurveyController::class, 'index'])
            ->name('surveys.index');

        // create must be BEFORE {survey} to avoid route conflict
        Route::get('/surveys/create', [SurveyController::class, 'create'])
            ->name('surveys.create');

        // bank-items must be BEFORE {survey} to avoid route conflict
        Route::delete('/surveys/bank-items/{itemId}', [SurveyController::class, 'deleteBankItem'])
            ->name('surveys.bank-items.destroy');

        Route::post('/surveys', [SurveyController::class, 'store'])
            ->name('surveys.store');

        // edit must be BEFORE {survey} generic show
        Route::get('/surveys/{survey}/edit', [SurveyController::class, 'edit'])
            ->name('surveys.edit');

        Route::put('/surveys/{survey}', [SurveyController::class, 'update'])
            ->name('surveys.update');

        Route::delete('/surveys/{survey}', [SurveyController::class, 'destroy'])
            ->name('surveys.destroy');

        // Publish — generates link_token, sets status = active
        // Returns JSON so Index.vue can update reactively without reload
        Route::patch('/surveys/{survey}/publish', [SurveyController::class, 'publish'])
            ->name('surveys.publish');

        // Toggle active ↔ closed — returns JSON
        Route::patch('/surveys/{survey}/toggle-status', [SurveyController::class, 'toggleStatus'])
            ->name('surveys.toggle-status');

        // Submit member response
        Route::post('/surveys/{survey}/respond', [SurveyController::class, 'respond'])
            ->name('surveys.respond');

        // Results analytics dashboard — creator only
        Route::get('/surveys/{survey}/results', [SurveyController::class, 'results'])
            ->name('surveys.results');

        // Take the survey (member) — must come AFTER all named /surveys/* routes
        Route::get('/surveys/{survey}', [SurveyController::class, 'show'])
            ->name('surveys.show');

        // ══════════════════════════════════════════════════════════════════
        //  ADD THIS BLOCK inside the member route group in web.php
        //  Place it right after the dashboard + preferences block,
        //  before the cases routes.
        //
        //  member.profile.index         GET    /app/profile
        //  member.profile.update        PATCH  /app/profile
        //  member.profile.hubs          PATCH  /app/profile/hubs
        //  member.profile.privacy       PATCH  /app/profile/privacy
        //  member.profile.notifications PATCH  /app/profile/notifications
        //  member.profile.password      PATCH  /app/profile/password
        // ══════════════════════════════════════════════════════════════════
        
        // ── Profile & Settings ─────────────────────────────────────────
        Route::get('/profile', [ProfileController::class, 'index'])
            ->name('profile.index');
        
        Route::patch('/profile', [ProfileController::class, 'update'])
            ->name('profile.update');
        
        Route::patch('/profile/hubs', [ProfileController::class, 'updateHubs'])
            ->name('profile.hubs');
        
        Route::patch('/profile/privacy', [ProfileController::class, 'updatePrivacy'])
            ->name('profile.privacy');
        
        Route::patch('/profile/notifications', [ProfileController::class, 'updateNotifications'])
            ->name('profile.notifications');
        
        Route::patch('/profile/password', [ProfileController::class, 'updatePassword'])
            ->name('profile.password');

    });

// ── Auth Routes (Breeze) ───────────────────────────────────────
require __DIR__.'/auth.php';