<?php

use App\Http\Controllers\Admin\BlogCategoryController;
use App\Http\Controllers\Admin\BlogCommentController;
use App\Http\Controllers\Admin\BlogController;
use App\Http\Controllers\Admin\BlogTagController;
use App\Http\Controllers\Admin\CompanyController;
use Illuminate\Support\Facades\Route;

use App\Http\Controllers\Admin\IndexController;
use App\Http\Controllers\Admin\LoginController;
use App\Http\Controllers\Admin\SiteManagementController;

Route::controller(LoginController::class)
	->middleware(['guest'])
	->withoutMiddleware('auth:admin')
	->group(function () {
		Route::get('login', 'showLoginForm')->name('login');
		Route::post('login', 'login')->name('login.submit');
		Route::get('logout', 'logout')->name('logout');
	});

// Password reset routes
// Route::post('password/email', 'ForgotPasswordController@sendResetLinkEmail')->name('admin.password.email');
// Route::get('password/reset', 'ForgotPasswordController@showLinkRequestForm')->name('admin.password.request');
// Route::post('password/reset', 'ResetPasswordController@reset');
// Route::get('password/reset/{token}', 'ResetPasswordController@showResetForm')->name('admin.password.reset');

Route::controller(IndexController::class)->group(function () {
	Route::any('', 'index')->name('index');
	Route::get('dashboard', 'dashboard')->name('dashboard');
});

Route::resource('company', CompanyController::class);
Route::controller(CompanyController::class)->prefix('company')->group(function () {
	Route::get('{company}/disable', 'disable')->name('company.disable');
	Route::get('{company}/enable', 'enable')->name('company.enable')->withTrashed();
});

Route::resource('siteManagement', SiteManagementController::class);
Route::controller(SiteManagementController::class)->prefix('siteManagement')->group(function () {
	Route::get('{siteManagement}/disable', 'disable')->name('siteManagement.disable');
	Route::get('{siteManagement}/enable', 'enable')->name('siteManagement.enable')->withTrashed();
});

Route::resource('blog', BlogController::class);
Route::controller(BlogController::class)->prefix('blog')->group(function () {
	Route::get('{blog}/disable', 'disable')->name('blog.disable');
	Route::get('{blog}/enable', 'enable')->name('blog.enable')->withTrashed();
});

Route::resource('blogCategory', BlogCategoryController::class);
Route::controller(BlogCategoryController::class)->prefix('blogCategory')->group(function () {
	Route::get('{blogCategory}/disable', 'disable');
	Route::get('{blogCategory}/enable', 'enable')->name('blogCategory.enable')->withTrashed();
});

Route::resource('blogTag', BlogTagController::class);
Route::controller(BlogTagController::class)->prefix('blogTag')->group(function () {
	Route::get('{blogTag}/disable', 'disable')->name('blogTag.disable');
	Route::get('{blogTag}/enable', 'enable')->name('blogTag.enable')->withTrashed();
});

Route::resource('blogComment', BlogCommentController::class);
Route::controller(BlogCommentController::class)->prefix('blogComment')->group(function () {
	Route::get('{blogComment}/disable', 'disable')->name('blogComment.disable');
	Route::get('{blogComment}/enable', 'enable')->name('blogComment.enable')->withTrashed();
});
