<?php


use Illuminate\Support\Facades\Auth;
use App\Http\Middleware\Authenticate;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\AnnouncementController;
use App\Http\Controllers\BlogController;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\HomeController;


/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Auth::routes();


Route::get('/home', function() {
    return redirect()->route('blogs.index');
});

Route::controller(HomeController::class)->group(function () {
    Route::get('/', 'index');

    Route::get('/trade-investment', 'tradeInvestment');
    Route::get('/tourism', 'tourism');
    Route::get('/overseas-voting', 'overseasVoting');
    Route::get('/about-us', 'aboutUs');
    Route::get('/contact-us', 'contactUs');
    
    Route::get('/passport/{info?}', 'passport');
    Route::get('/civil-registration/{report?}', 'civilRegistration');
    Route::get('/visa/{info?}', 'visa');
    
    Route::get('/notarials-legalization', 'notarialsLegalization');
    Route::get('/nbi-clearance', 'nbiClearance');
    Route::get('/citizenship', 'citizenship');
    Route::get('/travel-document', 'travelDocument');
    Route::get('/sss', 'sss');
    Route::get('/consular-service', 'consularService');
    Route::get('/holidays', 'holidays');
    Route::get('/saturday-services', 'saturdayServices');
    Route::get('/announcement', 'announcement');
    Route::get('/consular-outreach', 'consularOutreach');
    Route::get('/advisory', 'advisory');
    Route::get('/press-release', 'pressRelease');
    
    Route::get('/about-the-consul-general', 'aboutConsulGeneral');
    Route::get('/vision-mission', 'visionMission');
    Route::get('/citizens-charter', 'citizensCharter');

    Route::get('/press/{blog}', 'blog');
});



Route::get('clear', function () {
    Artisan::call('optimize:clear');
});

Route::middleware([Authenticate::class])->group(function () {
    Route::group(['prefix' => 'admin',], function () {
        Route::get('/', [BlogController::class, 'index'])->name('home');
        Route::resource('announcements', AnnouncementController::class)->except(['show']);
        Route::resource('blogs', BlogController::class)->except(['show']);
        Route::resource('categories', CategoryController::class)->except(['show']);
        
        Route::get('announcements/list', [AnnouncementController::class, 'list'])->name('announcements.list');
        Route::get('blogs/list', [BlogController::class, 'list'])->name('blogs.list');
        Route::get('categories/list', [CategoryController::class, 'list'])->name('categories.list');
    });
});
