<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
use App\Http\Controllers\ApplyController;
use App\Http\Controllers\AdminController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/
Route::get('/index', [UserController::class, 'categoriesAPI']);
Route::post('/createuser', [UserController::class, 'regAPI']);
Route::post('/authuser', [UserController::class, 'authAPI']);
// Route::get('/post={post}', [PostController::class, 'postAPI']);
// Route::get('/user={post}', [PostController::class, 'userAPI']);


Route::middleware('auth:sanctum')->group(function () {
    Route::get('/user', function (Request $request) {
        return $request->user();
    });
    Route::get('/getuser', [UserController::class, 'auser']);
    Route::get('/account', [UserController::class, 'accountAPI']);
    Route::get('/logout', [UserController::class, 'logoutAPI']);
    Route::get('/account', [UserController::class, 'accountAPI']);
    Route::post('/addcategory', [AdminController::class, 'addcategoryAPI']);
    Route::get('/myapply', [ApplyController::class, 'myapplyAPI']);
    Route::post('/addapply', [ApplyController::class, 'addapplyAPI']);
    Route::post('/applytrue/{id}', [AdminController::class, 'applytrue']);
    Route::post('/applyfalse/{id}', [AdminController::class, 'applyfalse']);
});