<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\todoController;
Route::prefix('auth')->group(function (): void {
    Route::post('register', [AuthController::class, 'register']);
    Route::post('login', [AuthController::class, 'login']);
    Route::middleware('auth:sanctum')->group(function (): void {
        Route::post('logout', [AuthController::class, 'logout']);
        Route::get('me', [AuthController::class, 'me']);
        Route::patch('me', [AuthController::class, 'update']);
    });

});
Route::middleware('auth:sanctum')->prefix('todos')->group(function (): void {
    Route::get('/', [todoController::class, 'index']);
    Route::post('/', [todoController::class, 'store']);
    Route::get('/{todo}', [todoController::class, 'show']);
    Route::patch('/{todo}', [todoController::class, 'update']);
    Route::delete('/{todo}', [todoController::class, 'destroy']);
});
