<?php

use App\Http\Controllers\Auth\SanctumAuthController;
use App\Http\Controllers\FrontMediaController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'user'], function () {
    Route::post('/register', [SanctumAuthController::class, 'register']);
    Route::post('/login', [SanctumAuthController::class, 'login']);
});

Route::middleware('auth:sanctum')->group(function () {

    Route::group(['prefix' => 'user'], function () {
        Route::get('/', function (Request $request) {
            return $request->user();
        });

        Route::post('/logout', [SanctumAuthController::class, 'logout']);
    });
});

Route::group(['prefix' => 'app'], function () {

    Route::post('init', [FrontMediaController::class, 'init'])->name('api.app.init');

    Route::post('memes', [FrontMediaController::class, 'memes'])->name('api.app.memes');

    Route::post('background', [FrontMediaController::class, 'background'])->name('api.app.background');
});
