<?php

use App\Modules\Platform\Geography\Controllers\GeographyPageController;
use Illuminate\Support\Facades\Route;

Route::prefix('settings/geography')
    ->name('settings.geography.')
    ->group(function (): void {
        Route::get('/', [GeographyPageController::class, 'index'])
            ->middleware('can:geography.view')
            ->name('index');

        Route::get('/countries', [GeographyPageController::class, 'countriesIndex'])
            ->middleware('can:geography.view')
            ->name('countries.index');

        Route::get('/regions', [GeographyPageController::class, 'regionsIndex'])
            ->middleware('can:geography.view')
            ->name('regions.index');

        Route::get('/regions/create', [GeographyPageController::class, 'regionsCreate'])
            ->middleware('can:geography.manage')
            ->name('regions.create');

        Route::post('/regions', [GeographyPageController::class, 'regionsStore'])
            ->middleware('can:geography.manage')
            ->name('regions.store');

        Route::get('/regions/{region}/edit', [GeographyPageController::class, 'regionsEdit'])
            ->middleware('can:geography.manage')
            ->name('regions.edit');

        Route::put('/regions/{region}', [GeographyPageController::class, 'regionsUpdate'])
            ->middleware('can:geography.manage')
            ->name('regions.update');

        Route::post('/regions/{region}/deactivate', [GeographyPageController::class, 'regionsDeactivate'])
            ->middleware('can:geography.manage')
            ->name('regions.deactivate');

        Route::get('/cities', [GeographyPageController::class, 'citiesIndex'])
            ->middleware('can:geography.view')
            ->name('cities.index');

        Route::get('/cities/create', [GeographyPageController::class, 'citiesCreate'])
            ->middleware('can:geography.manage')
            ->name('cities.create');

        Route::post('/cities', [GeographyPageController::class, 'citiesStore'])
            ->middleware('can:geography.manage')
            ->name('cities.store');

        Route::get('/cities/{city}/edit', [GeographyPageController::class, 'citiesEdit'])
            ->middleware('can:geography.manage')
            ->name('cities.edit');

        Route::put('/cities/{city}', [GeographyPageController::class, 'citiesUpdate'])
            ->middleware('can:geography.manage')
            ->name('cities.update');

        Route::post('/cities/{city}/deactivate', [GeographyPageController::class, 'citiesDeactivate'])
            ->middleware('can:geography.manage')
            ->name('cities.deactivate');
    });
