<?php

use App\Modules\HR\Recruitment\Controllers\CareerPortalPublicController;
use App\Modules\HR\Recruitment\Middleware\ResolveCareerPortalTenant;
use Illuminate\Support\Facades\Route;

Route::middleware(['web', ResolveCareerPortalTenant::class])
    ->prefix('careers/{tenant}')
    ->name('careers.')
    ->group(function () {
        Route::get('/', [CareerPortalPublicController::class, 'home'])->name('home');
        Route::get('/jobs', [CareerPortalPublicController::class, 'jobs'])->name('jobs');
        Route::get('/jobs/{vacancy}', [CareerPortalPublicController::class, 'show'])->name('jobs.show');
        Route::get('/jobs/{vacancy}/apply', [CareerPortalPublicController::class, 'applyForm'])->name('jobs.apply');
        Route::post('/jobs/{vacancy}/apply', [CareerPortalPublicController::class, 'applyStore'])
            ->name('jobs.apply.store');
        Route::get('/confirmation/{token}', [CareerPortalPublicController::class, 'confirmation'])
            ->name('confirmation');
        Route::get('/track', [CareerPortalPublicController::class, 'trackForm'])->name('track');
        Route::post('/track', [CareerPortalPublicController::class, 'trackLookup'])->name('track.lookup');
        Route::get('/track/{token}', [CareerPortalPublicController::class, 'trackShow'])->name('track.show');
    });
