<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\ApiController;
use App\Http\Controllers\CheckSubscriptionController;
use App\Http\Controllers\RombakTokenController;
use App\Http\Controllers\PlayController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
*/

Route::get('/', function () {
    return redirect()->route('admin.panel');
});

Route::prefix('admin')->group(function () {
    Route::get('/', [AdminController::class, 'index'])->name('admin.panel');
    Route::post('/', [AdminController::class, 'index'])->name('admin.panel.post');
    Route::post('/login', [AdminController::class, 'login'])->name('admin.login');
    Route::get('/logout', [AdminController::class, 'logout'])->name('admin.logout');
});


Route::get('/check_subscription', [CheckSubscriptionController::class, 'index']);

Route::prefix('api')->group(function () {
    Route::get('/{action}', [ApiController::class, 'handleGet']);
    Route::post('/{action}', [ApiController::class, 'handlePost']);
    Route::put('/{action}', [ApiController::class, 'handlePut']);
    Route::patch('/{action}', [ApiController::class, 'handlePatch']);
    Route::delete('/{action}', [ApiController::class, 'handleDelete']);
});
