<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
use App\Http\Controllers\BlogController;
use App\Http\Controllers\ContactController;
use App\Http\Controllers\WebsiteController;
use App\Http\Controllers\JobApplicationController;

/*
|--------------------------------------------------------------------------
| Website
|--------------------------------------------------------------------------
*/

Route::controller(WebsiteController::class)->group(function () {

    Route::get('/', 'index')->name('home');
    Route::get('/about', 'about')->name('about');
    Route::get('/services', 'service')->name('services');
    Route::get('/practice-areas', 'practiceAreas')->name('practice.areas');
    Route::get('/team', 'team')->name('team');
    Route::get('/careers', 'careers')->name('careers');
    Route::get('/contact', 'contact')->name('contact');
});

Route::post('/career/apply', [JobApplicationController::class, 'store'])
    ->name('career.apply');
/*
|--------------------------------------------------------------------------
| Blog Website
|--------------------------------------------------------------------------
*/

Route::get('/blogs', [BlogController::class, 'blogs'])->name('blogs');

Route::get('/blog/{slug}', [BlogController::class, 'show'])->name('blog.details');


/*
|--------------------------------------------------------------------------
| Contact
|--------------------------------------------------------------------------
*/

Route::post('/contact/store', [ContactController::class, 'store'])->name('contact.store');


/*
|--------------------------------------------------------------------------
| Guest
|--------------------------------------------------------------------------
*/

Route::middleware('guest')->group(function () {

    Route::get('/register', [UserController::class, 'register'])->name('register');

    Route::post('/register', [UserController::class, 'store'])->name('register.store');

    Route::get('/login', [UserController::class, 'login'])->name('login');

    Route::post('/login', [UserController::class, 'authenticate'])->name('login.authenticate');
});


/*
|--------------------------------------------------------------------------
| Dashboard
|--------------------------------------------------------------------------
*/

Route::middleware('auth')->prefix('dashboard')->group(function () {

    Route::get('/', [UserController::class, 'dashboard'])->name('dashboard');

    Route::get('/users', [UserController::class, 'show'])->name('users.show');

    Route::get('/users/edit/{id}', [UserController::class, 'edit'])->name('user.edit');

    Route::post('/users/update/{id}', [UserController::class, 'update'])->name('user.update');

    Route::get('/users/delete/{id}', [UserController::class, 'destroy'])->name('user.delete');


    Route::get('/contacts', [ContactController::class, 'show'])->name('contacts.show');

    Route::delete('/contacts/{id}', [ContactController::class, 'destroy'])->name('contacts.destroy');


    Route::get('/blogs', [BlogController::class, 'index'])->name('blogs.index');

    Route::get('/blogs/create', [BlogController::class, 'create'])->name('blogs.create');

    Route::post('/blogs/store', [BlogController::class, 'store'])->name('blogs.store');

    Route::get('/blogs/edit/{id}', [BlogController::class, 'edit'])->name('blogs.edit');

    Route::put('/blogs/update/{id}', [BlogController::class, 'update'])->name('blogs.update');

    Route::delete('/blogs/delete/{id}', [BlogController::class, 'destroy'])->name('blogs.destroy');


    Route::get('/profile', [UserController::class, 'profile'])->name('profile');

    Route::post('/change-password', [UserController::class, 'changePassword'])->name('change.password');

    Route::get('/logout', [UserController::class, 'logout'])->name('logout');
});

Route::middleware('auth')->prefix('dashboard')->group(function () {

    Route::get('/applications', [JobApplicationController::class, 'index'])
        ->name('applications.index');

    Route::get('/applications/{id}', [JobApplicationController::class, 'show'])
        ->name('applications.show');

    Route::delete('/applications/{id}', [JobApplicationController::class, 'destroy'])
        ->name('applications.destroy');

    Route::get('/applications/download/{id}', [JobApplicationController::class, 'downloadResume'])
        ->name('applications.download');
    Route::post('/applications/status/{id}', [JobApplicationController::class, 'updateStatus'])
        ->name('applications.status');
});



    // |--------------------------------------------------------------------------
    // | Individual Service Pages
    // |--------------------------------------------------------------------------
    // */
Route::get('/commercial-financial-disputes', [WebsiteController::class, 'commercialFinancialDisputes'])->name('commercial.financial.disputes');

Route::get('/commercial-contracts', [WebsiteController::class, 'commercialContracts'])->name('commercial.contracts');

Route::get('/tax-disputes', [WebsiteController::class, 'taxDisputes'])->name('tax.disputes');

Route::get('/labour-employment-law', [WebsiteController::class, 'labourEmployment'])->name('labour.employment');

Route::get('/foreign-investment', [WebsiteController::class, 'foreignInvestment'])->name('foreign.investment');

Route::get('/intellectual-property', [WebsiteController::class, 'intellectualProperty'])->name('intellectual.property');

Route::get('/banking-finance', [WebsiteController::class, 'bankingFinance'])->name('banking.finance');

Route::get('/commercial-arbitration', [WebsiteController::class, 'commercialArbitration'])->name('commercial.arbitration');

Route::get('/bankruptcy', [WebsiteController::class, 'bankruptcy'])->name('bankruptcy');

Route::get('/corporate-law-governance', [WebsiteController::class, 'corporateLaw'])->name('corporate.law');
