<?php

use App\Http\Controllers\BankSoapController;
use App\Http\Controllers\BanqueInfoController;
use App\Http\Controllers\ClientController;
use App\Http\Controllers\OrangeMoneyController;
use App\Http\Controllers\RegistrationModuleController;
use App\Http\Controllers\ServeurController;
use App\Http\Controllers\SoapApiController;
use App\Http\Controllers\SoapRequestController;
use App\Http\Controllers\StatusInqueryController;
use App\Http\Controllers\TraceController;
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('admin.login');
});
Route::post('register', [OrangeMoneyController::class, 'registerCustomer']);
Route::get('checkidlestatus', [OrangeMoneyController::class, 'checkIdleStatus']);
Route::get('get_balance_form', [OrangeMoneyController::class, 'get_balance_form']);
Route::post('/get-account-balance', [OrangeMoneyController::class, 'getAccountBalance']);
Route::get('teste_soap_api', [OrangeMoneyController::class, 'sendSoapRequest']);
Route::post('teste_soap_api', [OrangeMoneyController::class, 'sendSoapRequest']);
Route::post('/check-transaction-status', [OrangeMoneyController::class, 'checkTransactionStatus']);
Route::get('/check-idle', [OrangeMoneyController::class, 'checkIdle']);
Route::post('/register-client-with-key', [OrangeMoneyController::class, 'registerClientWithKey']);

//USER
Route::get('login', function () {
    return view('admin.login');
});
Route::get('dash', [UserController::class, 'index'])->middleware(['roleChecker']);

Route::get('new_user', [UserController::class, 'new_user'])->middleware(['roleChecker']);
Route::get('liste_user', [UserController::class, 'liste_user'])->middleware(['roleChecker']);
Route::post('store_user', [UserController::class, 'store'])->middleware(['roleChecker']);
Route::get('edit_user/{id}', [UserController::class, 'edit_user'])->middleware(['roleChecker']);
Route::post('update_user', [UserController::class, 'update'])->middleware(['roleChecker']);
Route::get('delete_user/{id}', [UserController::class, 'destroy'])->middleware(['roleChecker']);
Route::post('login', [UserController::class, 'login']);

///REGISTRATION MODULES
//CHECKING
Route::get('check_key_form', [RegistrationModuleController::class, 'check_key_form'])->middleware(['roleChecker']);

Route::post('kyc-request', [RegistrationModuleController::class, 'kycRequest'])->middleware(['roleChecker']);
//VALIDATION
Route::get('confirm_registration_form', [RegistrationModuleController::class, 'confirm_registration_form'])->middleware(['roleChecker']);
Route::get('confirm_registration_form_link/{msisdn}/{key}', [RegistrationModuleController::class, 'confirm_registration_form_link'])->middleware(['roleChecker']);
Route::post('confirm_registration', [RegistrationModuleController::class, 'confirm_registration'])->middleware(['roleChecker']);
//DISABLED
Route::get('disable_client_form', [RegistrationModuleController::class, 'disable_client_form'])->middleware(['roleChecker']);
Route::post('close_account', [RegistrationModuleController::class, 'close_account'])->middleware(['roleChecker']);

//Client
Route::get('liste_client', [ClientController::class, 'index'])->middleware(['roleChecker']);
//Own API SOAP Service
Route::post('/soap/get-account-balance_teste', [SoapRequestController::class, 'getAccountBalance_teste']);
Route::post('/soap-call', [SoapRequestController::class, 'addNumbers']);
Route::post('/xml-endpoint', [SoapRequestController::class, 'handleRequest']);

//Request API SOAP Service
Route::post('/get_account_balance_teste', [SoapRequestController::class, 'handleSoapRequest']);
Route::post('/bank2wallet', [SoapRequestController::class, 'bank2wallet']);
//NEXT API SOAP Service
//WSDL PARTENER LINK http://your-app.com/soap/partner/wsdl
Route::get('/soap/partner/wsdl', function () {
    return response()->file(resource_path('wsdl/partner.wsdl'), [
        'Content-Type' => 'application/xml',
    ]);
});

//STATUS TRANSACTION
Route::get('check_transaction_status_form', [StatusInqueryController::class, 'check_transaction_status_form'])->middleware(['roleChecker']);
Route::post('last-transactions', [StatusInqueryController::class, 'lastTransactions'])->middleware(['roleChecker']);

Route::get('transaction_status', [StatusInqueryController::class, 'transaction_status'])->middleware(['roleChecker']);
Route::post('transaction-status-inquiry', [StatusInqueryController::class, 'transactionStatusInquiry'])->middleware(['roleChecker']);
//Serveur
Route::get('new_server', [ServeurController::class, 'index'])->middleware(['roleChecker']);
Route::get('liste_serveur', [ServeurController::class, 'liste_serveur'])->middleware(['roleChecker']);
Route::post('store_serveur', [ServeurController::class, 'store'])->middleware(['roleChecker']);
Route::post('update_serveur', [ServeurController::class, 'update'])->middleware(['roleChecker']);
Route::get('edit_serveur/{id}', [ServeurController::class, 'edit'])->middleware(['roleChecker']);
Route::get('delete_serveur/{id}', [ServeurController::class, 'destroy'])->middleware(['roleChecker']);

//BANK INQUERY
Route::get('bank_inquery', [StatusInqueryController::class, 'bank_inquery'])->middleware(['roleChecker'])->name('transaction.filter');
Route::post('bank_inquery', [StatusInqueryController::class, 'bank_inquery'])->middleware(['roleChecker'])->name('transaction.filter');
Route::get('bank_transaction_status', [StatusInqueryController::class, 'bank_transaction_status'])->middleware(['roleChecker']);
//----------------------------------------------------------------
//IDLE
Route::get('idle_mode', [RegistrationModuleController::class, 'idle_mode'])->middleware(['roleChecker']);
Route::POST('set_idle', [RegistrationModuleController::class, 'setIdle'])->middleware(['roleChecker'])->name('setIdle');
//Log
Route::get('trace', [TraceController::class, 'index'])->middleware(['roleChecker']);
Route::get('sql_log', [TraceController::class, 'sql_log'])->middleware(['roleChecker']);
Route::get('sql_log', [TraceController::class, 'sql_log'])->middleware(['roleChecker']);
Route::get('error-logs', [TraceController::class, 'error_log'])->middleware(['roleChecker']);
//Banque info
Route::resource('banque_infos', BanqueInfoController::class);


Route::get('logout', [UserController::class, 'logout'])->middleware(['roleChecker']);
