<?php

use App\Http\Controllers\BlogController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\PreApplicationController;
use App\Http\Controllers\WebsiteController;
use App\Http\Controllers\TickerController;
use App\Http\Controllers\EventController;
use Illuminate\Support\Facades\Route;


Route::get('/', [WebsiteController::class, 'index']);

Route::get('/ueberuns', [WebsiteController::class, 'about'])->name('about');
Route::get('/dokumente', [WebsiteController::class, 'documents'])->name('documents');
Route::get('/kontakt', [WebsiteController::class, 'contact'])->name('contact');
Route::get('/faq', [WebsiteController::class, 'faq'])->name('faq');
Route::get('/impressum', [WebsiteController::class, 'imprint'])->name('imprint');
Route::get('/services', [WebsiteController::class, 'services'])->name('services');
Route::get('/neuigkeiten', [WebsiteController::class, 'news'])->name('news');

Route::get('/vorbeantragen', [WebsiteController::class, 'apply'])->name('apply');
Route::post('/vorbeantragen/absenden', [PreApplicationController::class, 'send']);

Route::get('/intern/registrieren', [WebsiteController::class, 'showRegister']);
Route::post('/intern/registrieren/abschicken', [LoginController::class, 'register']);

Route::get('/intern/anmelden', [WebsiteController::class, 'showLogin']);
Route::post('/intern/anmelden/einloggen', [LoginController::class, 'login']);

Route::get('/intern/abmelden', function(){
    Auth::logout();
    return redirect("/");
})->name('logout');

Route::get('/intern/ticker', [WebsiteController::class, 'editTicker'])->name('editTicker');
Route::delete('/intern/ticker/remove', [TickerController::class, 'deleteTicker']);
Route::put('/intern/ticker/add', [TickerController::class, 'addTicker']);


Route::get('/intern/nachrichten', [WebsiteController::class, 'editNews'])->name('editNews');
Route::post('/intern/nachrichten/add', [BlogController::class, 'addBlog']);
Route::delete('/intern/nachrichten/delete', [BlogController::class, 'deleteBlog']);
Route::put('/intern/nachrichten/edit', [BlogController::class, 'editBlog']);

Route::get('/intern/antraege', [WebsiteController::class, 'editApplications'])->name('editApplications');
Route::get('/intern/antraege/generate-pdf', [PreApplicationController::class, 'generatePDF'])->name('generatePDF');
Route::post('/intern/antraege/hinzufuegen', [PreApplicationController::class, 'addApplication']);
Route::delete('/intern/antraege/loeschen', [PreApplicationController::class, 'deleteApplication']);
Route::put('/intern/antraege/bearbeiten', [PreApplicationController::class, 'editApplication']);

Route::get('/intern/events', [WebsiteController::class, 'editEvents'])->name('editEvents');
Route::post('/intern/events/hinzufuegen', [EventController::class, 'addEvent']);
Route::delete('/intern/events/loeschen', [EventController::class, 'deleteEvent']);
Route::patch('/intern/events/setActivity', [EventController::class, 'setActivity']);
