<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Api\AuthController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\ProfileController;
use App\Http\Controllers\Api\AttendanceController;
use App\Http\Controllers\Api\ClientController;
use App\Http\Controllers\Api\DepartmentController;
use App\Http\Controllers\Api\DesignationController;
use App\Http\Controllers\Api\EmployeeController;
use App\Http\Controllers\Api\LeaveTypeController;
use App\Http\Controllers\Api\LeaveController;
use App\Http\Controllers\Api\LoanController;
use App\Http\Controllers\Api\PayrollItemController;
use App\Http\Controllers\Api\PayrollController;
use App\Http\Controllers\Api\SalaryStructureController;


/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
*/

Route::post('login', [AuthController::class, 'login']);
Route::post('forgot-password', [AuthController::class, 'forgotPassword']);

Route::middleware('api.auth')->group(function () {

    Route::post('logout', [AuthController::class, 'logout']);

    Route::get('profile', [ProfileController::class, 'profile']);
    Route::put('profile', [ProfileController::class, 'update']);

    Route::apiResource('users', UserController::class);

    
    Route::apiResource('attendances', AttendanceController::class);
    Route::apiResource('clients', ClientController::class);
    Route::apiResource('departments', DepartmentController::class);
    Route::apiResource('designations', DesignationController::class);
    Route::apiResource('employees', EmployeeController::class);
    Route::apiResource('leave-types', LeaveTypeController::class);
    Route::apiResource('leaves', LeaveController::class);
    Route::apiResource('loans', LoanController::class);
    Route::apiResource('payroll-items', PayrollItemController::class);
    Route::apiResource('payrolls', PayrollController::class);
    Route::apiResource('salary-structures', SalaryStructureController::class);
});
