<?php

use App\Http\Controllers\Services\CountriesListController;
use App\Http\Controllers\Billplz\CallbackBillplzController;
use App\Http\Controllers\Documents\RenderDocumentController;
use App\Http\Controllers\Imports\ImportUpdateDebtorController;
use App\Http\Controllers\Imports\ImportHoneyTrapController;
use App\Http\Controllers\Imports\ImportStatementInvoiceController;
use App\Http\Controllers\Imports\ImportStatementReceiptsController;
use App\Http\Controllers\Companies\BulkDownloadCustomerInvoicesController;
use App\Http\Controllers\Companies\BulkDownloadSupplierWhiteFormsController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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::group(['prefix' => 'v1', 'as' => 'api.'], function () {

    require __DIR__ . '/account.php';

//    Route::get('/rate/calculate', [RateCalculateCurrencyController::class, 'convert'])->name('calculate');

    Route::group(['prefix' => 'service', 'as' => 'service.'], function () {
        Route::get('countries/list', [CountriesListController::class, 'index'])->name('list.countries');
    });

    Route::post('online_payment/callback', [CallbackBillplzController::class, 'callback'])->name('online_payment.callback');

    Route::group(['middleware' => 'valid.token'], function () {
        Route::group(['middleware' => 'admin'], function () { //cief maintenance

            Route::get('/storage/{fileName}/fetch', [RenderDocumentController::class, 'fileStorageServe'])->where(['fileName' => '.*'])->name('storage.document.file');
            Route::post('/import/update-debtor/f614e339d7058904a831aad742e24d55', [ImportUpdateDebtorController::class, 'import'])->name('debtor.import');
            Route::post('/import/upload-honey-trap', [ImportHoneyTrapController::class, 'import'])->name('honey_trap.upload');
            Route::post('/import/upload-import-invoices', [ImportStatementInvoiceController::class, 'import'])->name('import_invoices.upload');
            Route::post('/import/upload-import-receipt', [ImportStatementReceiptsController::class, 'import'])->name('import_receipts.upload');
            Route::post('/customers/invoices', [BulkDownloadCustomerInvoicesController::class, 'download'])->name('customers.invoices');
            Route::post('/supplier/white-form/bulk-download', [BulkDownloadSupplierWhiteFormsController::class, 'download'])->name('suppliers.white_forms');

            require __DIR__ . '/company.php';

            require __DIR__ . '/document.php';

            require __DIR__ . '/segment.php';

            require __DIR__ . '/segment_constant.php';

            require __DIR__ . '/currency.php';

            require __DIR__ . '/bank.php';

            require __DIR__ . '/booking.php';

            require __DIR__ . '/transaction.php';

            require __DIR__ . '/crud.php';

            require __DIR__ . '/announcement.php';

            require __DIR__ . '/billplz.php';

            require __DIR__ . '/wallet.php';

            require __DIR__ . '/voucher.php';

            require __DIR__ . '/accounting.php';

            require __DIR__ . '/reward.php';

            require __DIR__ . '/milestone.php';

            require __DIR__ . '/remark.php';

            require __DIR__ . '/job.php';

            require __DIR__ . '/rule.php';

            require __DIR__ . '/export.php';

            require __DIR__ . '/key_value_pair.php';

            require __DIR__ . '/setting.php';
            
            require __DIR__ . '/affiliate.php';

            //        require __DIR__ . '/rate.php';
            //        require __DIR__ . '/receipt.php';
        });
    });
});
