<?php

use App\Http\Controllers\AdminAuthController;
use App\Http\Controllers\GameController;
use App\Http\Controllers\PlayerAuthController;
use Illuminate\Support\Facades\Route;

Route::middleware('guest')->group(function () {
	Route::get('/jogador/login', [PlayerAuthController::class, 'showLogin'])->name('login');
	Route::post('/jogador/login', [PlayerAuthController::class, 'login'])->name('player.login.submit');
	Route::get('/jogador/cadastro', [PlayerAuthController::class, 'showRegister'])->name('register');
	Route::post('/jogador/cadastro', [PlayerAuthController::class, 'register'])->name('player.register.submit');
});

Route::middleware('auth')->group(function () {
	Route::get('/', [GameController::class, 'index'])->name('game.index');
	Route::get('/game/live', [GameController::class, 'live'])->name('game.live');
	Route::get('/game/arena/live', [GameController::class, 'arenaLive'])->name('game.arena.live');
	Route::post('/game/avatar', [GameController::class, 'saveAvatar'])->name('game.avatar.save');
	Route::post('/guess', [GameController::class, 'guess'])->name('game.guess');
	Route::post('/reset', [GameController::class, 'reset'])->name('game.reset');
	Route::post('/jogador/logout', [PlayerAuthController::class, 'logout'])->name('logout');
});

Route::prefix('admin')->name('admin.')->group(function () {
	Route::get('/login', [AdminAuthController::class, 'showLogin'])->name('login');
	Route::post('/login', [AdminAuthController::class, 'login'])->name('login.submit');
	Route::get('/dashboard', [AdminAuthController::class, 'dashboard'])->name('dashboard');
	Route::get('/premios-saques', [AdminAuthController::class, 'cityPayout'])->name('city-payout.index');
	Route::post('/configuracao/premio-cidade', [AdminAuthController::class, 'saveCityPayout'])->name('city-payout.save');
	Route::get('/mercado-pago', [AdminAuthController::class, 'mercadoPago'])->name('mercadopago.index');
	Route::post('/mercado-pago', [AdminAuthController::class, 'saveMercadoPago'])->name('mercadopago.save');
	Route::post('/logout', [AdminAuthController::class, 'logout'])->name('logout');
});
