<?php

use App\Http\Controllers\AlunosController;
use App\Http\Controllers\EnvioWhatsap;
use App\Http\Controllers\EscolasController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\TurmasController;
use Illuminate\Support\Facades\Route;


// Rotas para Guest, sem necessidade de autenticação
Route::middleware('guest')->group(function () {
    Route::get('/', function () {
        return redirect()->route('login');
    });
});


// Rotas para Auth, Necessário autenticação
Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
    Route::get('/dashboard', function () {
        return view('dashboard');
    })->name('dashboard');
    Route::get('/escolas', [EscolasController::class, 'index'])->name('escolas');
    Route::post('/escolas', [EscolasController::class, 'createOrUpdate'])->name('escola.novo');
    Route::get('/turmas', [TurmasController::class, 'index'])->name('turmas');
    Route::get('/turmas/{id}', [TurmasController::class, 'detalhes'])->name('turmas.detalhes');
    Route::post('/turmas', [TurmasController::class, 'createOrUpdate'])->name('turma.novo');
    Route::get('/alunos', [AlunosController::class, 'index'])->name('alunos');
    Route::post('/envio-wpp', [EnvioWhatsap::class, 'envio'])->name('envio.wpp');
});



require __DIR__ . '/auth.php';
