<?php

use Modules\Client\Http\Controllers\Api\AuthController;
use Modules\Client\Http\Controllers\Api\CorporateDivisionController;
use Modules\Client\Http\Controllers\Api\CorporateManageController;
use Modules\Client\Http\Controllers\Api\CorporateMemberController;
use Modules\Client\Http\Controllers\Api\CorporatePolicyController;
use Modules\Client\Http\Controllers\Api\UserController;
use Modules\Client\Http\Controllers\Api\ClaimController;
use Modules\Client\Http\Controllers\Api\TopUpController;
use Modules\Client\Http\Controllers\Api\DataController;

/*
|--------------------------------------------------------------------------
| 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('client')->group(function () {

    Route::controller(AuthController::class)->group(function () {
        Route::post('login', 'login');
        Route::post('verify-code', 'validateOtp');
    });

    Route::middleware('auth:sanctum')->group(function () {
        Route::post('logout', [AuthController::class, 'logout'])->name('logout');
        Route::get('user', [UserController::class, 'index']);
        // Route::get('data/{id}', [DataController::class, 'show']);
        // Route::put('data/{id}', [DataController::class, 'update']);


        Route::get('corporate-manage', [CorporateManageController::class, 'index']);
        Route::prefix('{corporate_id}')->group(function () {
            Route::get('policy', [CorporatePolicyController::class, 'index']);
            Route::get('division', [CorporateDivisionController::class, 'index']);
            Route::get('members', [CorporateMemberController::class, 'index']);
            Route::get('claims/status', [ClaimController::class, 'status']);
            Route::get('claims', [ClaimController::class, 'index']);

            Route::get('topup', [TopUpController::class, 'index']);
            Route::post('topup', [TopUpController::class, 'store']);
        });

        Route::get('claims/{id}', [ClaimController::class, 'show']);
    });
});
