<?php

use Inertia\Inertia;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\UserController;
use App\Http\Controllers\ProjectController;
use App\Http\Controllers\UserOperationController;
use App\Http\Controllers\UspaOperationController;
use App\Http\Controllers\ProductBacklogController;

Route::get('/', function () {
    return Inertia::render('Welcome');
})->name('home');

Route::get('dashboard', function () {
    return Inertia::render('Dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware(['auth'])->group(function () {
    // User management routes
    Route::get('/user-management', [UserController::class, 'index'])->name('users.index');
    Route::get('/user-management/user-create', [UserController::class, 'create']);
    Route::post('/user-management/user-create', [UserController::class, 'store']);
    Route::delete('/user-management/{id}', [UserController::class, 'destroy']);
    Route::put('/user-management/{id}', [UserController::class, 'update']);


    // Project management routes
    Route::get('/project-management', [ProjectController::class, 'index'])->name('project.index');
    Route::get('/project-management/project-create', [ProjectController::class, 'create']);
    Route::post('/project-management/project-create', [ProjectController::class, 'store']);
    Route::delete('/project-management/{id}', [ProjectController::class, 'destroy']);
    Route::put('/project-management/{id}', [ProjectController::class, 'update']);

    // Product Backlogs routes
    Route::get('/product-backlogs', [ProductBacklogController::class, 'index'])->name('product-backlogs.index');
    Route::get('/product-backlogs/fus-create', [ProductBacklogController::class, 'create']);
    Route::post('/product-backlogs/fus-create', [ProductBacklogController::class, 'store']);
    Route::delete('/product-backlogs/{id}', [ProductBacklogController::class, 'destroy']);
    Route::put('/product-backlogs/{id}', [ProductBacklogController::class, 'update']);
    Route::get('/product-backlogs/non-functional-requirements', [ProductBacklogController::class, 'nfr']);
    Route::get('/product-backlogs/sprint-backlogs', [ProductBacklogController::class, 'sprintBacklogs']);

    // Fuzzy operations routes
    Route::get('/fuzzy-operations', [UserOperationController::class, 'index'])->name('fuzzy-operations.index');
    Route::get('/fuzzy-operations/add-operations', [UserOperationController::class, 'create']);
    Route::post('/fuzzy-operations/add-operations', [UserOperationController::class, 'store']);
    Route::get('/fuzzy-operations/edit-operations/{userOperation}', [UserOperationController::class, 'edit']);
    Route::put('/fuzzy-operations/edit-operations/{userOperation}', [UserOperationController::class, 'update']);
    Route::delete('/fuzzy-operations/{projectId}/{userId}', [UserOperationController::class, 'destroy']);
    Route::get('/fuzzy-operations/finals', [UserOperationController::class, 'finals']);

    // I-USPA operations routes
    Route::get('/i-uspa-decisions', [UspaOperationController::class, 'create'])->name('i-uspa-decisions.index');
    Route::post('/i-uspa-decisions', [UspaOperationController::class, 'store']);
    Route::get('/i-uspa-decisions/fu-finals', [UspaOperationController::class, 'FuFinals'])->name('i-uspa-decisions.fu-finals');
    Route::get('/i-uspa-decisions/nfr-finals', [UspaOperationController::class, 'NfrFinals']);
    Route::get('/i-uspa-decisions/my-votes', [UspaOperationController::class, 'MyVotes']);
    Route::get('/i-uspa-decisions/change-status', [UspaOperationController::class, 'EditStatus']);
    Route::put('/i-uspa-decisions/change-status/{project}', [UspaOperationController::class, 'UpdateStatus']);
    Route::post('/i-uspa-decisions/calculate/{projectId}', [UspaOperationController::class, 'calculate']);
});
require __DIR__.'/settings.php';
require __DIR__.'/auth.php';
