<?php

use Illuminate\Http\Request;
use Modules\HospitalPortal\Http\Controllers\Api\AuthController;
use Modules\HospitalPortal\Http\Controllers\Api\ClaimRequestController;
use Modules\HospitalPortal\Http\Controllers\Api\MemberController;
use Modules\HospitalPortal\Http\Controllers\ClaimController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::prefix('hospitalportal')->group(function () {

    Route::post('login', [AuthController::class, 'login'])->name('login');
    Route::post('forget-password', [AuthController::class, 'forgetPassword'])->name('forget-password');
    Route::post('verify-email', [AuthController::class, 'verifyEmail'])->name('verify-email');


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

        Route::post('logout', [AuthController::class, 'logout'])->name('logout');
        Route::get('/user', function (Request $request) {
            return $request->user();
        });
        Route::put('reset-password', [AuthController::class, 'resetPassword'])->name('resetPassword');

        Route::get('claims', [ClaimController::class, 'index']);

        Route::post('search-member', [MemberController::class, 'search']);

        Route::get('claim-requests', [ClaimRequestController::class, 'index'])->name('claim-requests.index');
        Route::post('claim-requests', [ClaimRequestController::class, 'store'])->name('claim-requests.store');
        Route::get('claim-requests/{claim_request_id}/log', [ClaimRequestController::class, 'generateLog'])->name('claim-requests.generate-log');
        Route::get('claim-requests/{id}', [ClaimRequestController::class, 'show'])->name('claim-requests.show');
    });
});
