<?php

use App\Http\Controllers\AdminBackend\SelectPeriodController;
use App\Http\Controllers\KuesionerLSController;
use App\Http\Controllers\KuesionerMetaController;
use App\Http\Controllers\MateriController;
use App\Http\Controllers\Auth\GoogleController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

Route::get('/', fn() => view('home'));
Route::get('/help', fn() => view('help'))->name('help');
Route::get('/landingpage', fn() => view('home'))->name('landingpage');

Route::get('/register', fn() => view('register'))->name('register');
Route::get('/login', fn() => view('login'))->name('login');
Route::get('auth/google', [GoogleController::class, 'redirectToGoogle'])->name('google.login');
Route::get('auth/google/callback', [GoogleController::class, 'handleGoogleCallback']);
Route::get('login-guest', [GoogleController::class, 'loginGuest'])->name('login-guest');
Route::get('/auth/redirect', fn() => Socialite::driver('github')->redirect());
Route::get('/auth/callback', fn() => $user = Socialite::driver('github')->user());

Route::get('/dashboard', [GoogleController::class, 'loadDataKuesioner'])->name('dashboard');
// Route::get('/dashboard', fn() => view('main.page.beranda.beranda'))->name('dashboard');

Route::get('/kuesioner', [GoogleController::class, 'loadDataKuesioner2'])->name('kuesioner');
Route::get('/kuesioner-panduan', fn() => view('main.page.kuesioner.kuesioner_panduan'))->name('kuesioner-panduan');
Route::get('/kuesioner-ls', fn() => view('main.page.kuesioner.kuesioner_learning_style'))->name('kuesioner-ls');
Route::get('/kuesioner-mai', [KuesionerMetaController::class, 'showquestion'])->name('kuesioner-mai');
Route::get('/kuesioner-hasil', fn() => view('main.page.kuesioner.kuesioner_hasil'))->name('kuesioner-hasil');
Route::post('/send-kuesioner-learning-style', [KuesionerLSController::class, 'store'])->name('send-kuesioner-learning-style');
Route::post('/send-kuesioner-metakognitif', [KuesionerMetaController::class, 'store'])->name('send-kuesioner-metacognitive');

Route::get('/materi-auditory', [MateriController::class, 'getListInstruction'])->name('materi-auditory');
Route::get('/materi-kinesthetic', [MateriController::class, 'getListInstruction'])->name('materi-kinesthetic');
Route::get('/materi-read/write', [MateriController::class, 'getListInstruction'])->name('materi-read/write');
Route::get('/materi-visual', [MateriController::class, 'getListInstruction'])->name('materi-visual');
Route::get('/materi-multimodal', [MateriController::class, 'getListInstruction'])->name('materi-multimodal');

Route::get('/profil', fn() => view('main.page.profil.profil'))->name('profil');
Route::post('/profile/update', [GoogleController::class, 'updateProfile'])->name('profile.update')->middleware('auth');
Route::delete('/profile/photo', [GoogleController::class, 'deleteProfilePhoto'])->name('profile.delete-photo')->middleware('auth');

Route::get('/logout', fn() => view('login'))->name('logout');