<?php

use App\Http\Controllers\MapController;
use App\Http\Controllers\PlacesController;
use App\Http\Controllers\Website\BandController;
use App\Http\Controllers\Website\ContactsController;
use App\Http\Controllers\Website\GigsController;
use App\Http\Controllers\Website\NewsController;
use App\Http\Controllers\Website\PlaylistController;
use App\Http\Controllers\Website\RiderController;
use App\Http\Controllers\Website\StartController;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\VkBotController;

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

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

Route::get('/', [StartController::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' ]);

Auth::routes();
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

/** VK api web hook */
Route::post('/vk-webhook', [ VkBotController::class, 'handle']);
