<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\ApiController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::post('/guest',[ApiController::class,'guest']);
Route::get('/avatarlist',[ApiController::class,'avatarlist']);
Route::get('/getavatar/{id}/',[ApiController::class,'getAvatarById']);
Route::get('/categorylist/',[ApiController::class,'categorylist']);
Route::post('/sociallogin',[ApiController::class,'SocialLogin']);
Route::post('/deluser',[ApiController::class,'deleteuser']);

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});

Route::group(['middleware' => ['auth:sanctum']],function()
{
    Route::post('/logout',[ApiController::class,'logout']);
    
    Route::get('/profile',[ApiController::class,'profile']);
    Route::post('/profileupdate',[ApiController::class,'profileUpdate']);
    Route::get('/quiz/{id}',[ApiController::class,'getQuizByCategory']);
    Route::get('/questions/{id}',[ApiController::class,'getQuestions']);
    Route::post('/submitquiz',[ApiController::class,'submitquiz']);
    Route::get('/getscore',[ApiController::class,'getScore']);
    Route::get('/getlocalranking/{country}',[ApiController::class,'getLocalRanking']);
     Route::get('/getWorldRanking',[ApiController::class,'getWorldRanking']);

});