<?php

use App\Http\Controllers\ProfileController;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\MainController;
use App\Http\Controllers\RiderController;
use App\Http\Controllers\PlaylistController;
use App\Http\Controllers\BandController;
use App\Http\Controllers\GigsController;
use App\Http\Controllers\NewsController;
use App\Http\Controllers\ContactsController;
use App\Http\Controllers\MapController;
use App\Http\Controllers\PlacesController;

Route::get('/welcome', function () {
    return view('welcome');
});

Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

Route::middleware('auth')
    ->group(function () {
        Route::get('/places', [PlacesController::class, 'index'])->name('places.index');
        Route::patch('/places', [PlacesController::class, 'update'])->name('places.update');
        Route::post('/places', [PlacesController::class, 'create'])->name('places.create');
        Route::delete('/places', [PlacesController::class, 'delete'])->name('places.delete');
});

Route::get('/', [MainController::class, 'index']);
Route::get('/rider', [RiderController::class, 'index']);
Route::get('/playlist', [PlaylistController::class, 'index']);
Route::get('/band', [BandController::class, 'index']);
Route::get('/gigs', [GigsController::class, 'index']);
Route::get('/news', [NewsController::class, 'index']);
Route::get('/contacts', [ContactsController::class, 'index']);

/** Yandex Maps */
Route::get('/map/index/id/{id}', [ MapController::class, 'index' ]);
Route::get('/api/getplace/id/{id}', [ MapController::class, 'getPlace' ]);

require __DIR__.'/auth.php';
