<?php

use App\Http\Controllers\HomeController;
use App\Http\Controllers\JobAutocompleteController;
use App\Http\Controllers\LocationController;
use App\Http\Controllers\OrganizationController;
use App\Http\Controllers\ProfileController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;



// Home / Landing Pages
Route::get('/', [HomeController::class, 'index'])->name('individual');
Route::get('/see-salary', [HomeController::class, 'seeSalary'])->name('see-salary');
Route::get('/business', function () {
    return view('home');
})->name('business');

// Google job autocomplete
Route::get('/google-job-autocomplete', [JobAutocompleteController::class, 'autocomplete']);

// Location API routes
Route::get('/countries', [LocationController::class, 'getCountries']);
Route::get('/states/{country}', [LocationController::class, 'getStates']);
Route::get('/cities/{country}/{state}', [LocationController::class, 'getCities']);

// Additional route files
    require __DIR__ . '/dashboard.php';
    require __DIR__ . '/rate-pay.php';
    require __DIR__ . '/community.php';
    require __DIR__ . '/profile.php';
    require __DIR__ . '/settings.php';
    require __DIR__ . '/job-descriptions.php';
    require __DIR__ . '/jd_wizard.php';

/*

| Routes that require the user to be logged in.
|
*/
Route::middleware(['auth'])->group(function () {

    // Salary viewing
    Route::get('/salary/{location}/{jobTitle}', [HomeController::class, 'viewSalary'])->name('view-salary');

    // Profile management
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');

    // User management
    Route::resource('users', UserController::class);

    // Organization management
    Route::resource('organizations', OrganizationController::class);
});

// Authentication routes
require __DIR__ . '/auth.php';