<?php

use App\Http\Controllers\FiuuEcrController;
use App\Http\Controllers\DynamicDbController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Fiuu cloudECR Routes
|--------------------------------------------------------------------------
|
| Routes for Fiuu cloudECR Terminal Payment Integration
|
*/

// Main page
// Route::get('/', [FiuuEcrController::class, 'index'])->name('fiuu.index');
Route::get('/', function () {
    echo 'test';
});
Route::get('/fetch-entries', [DynamicDbController::class, 'fetchEntries']);

Route::any('/dynamic-db/generate-pdf', [DynamicDbController::class, 'generatePDF'])->name('dynamic-db.generate-pdf');
Route::get('/ledgers/download-pdf/{filename}', [DynamicDbController::class, 'downloadPDF'])->name('ledgers.download-pdf');
Route::any('/dynamic-db/pdf-status', [DynamicDbController::class, 'checkPDFStatus'])->name('dynamic-db.pdf-status');

// Authentication routes
Route::post('/api/fiuu/login', [FiuuEcrController::class, 'login'])->name('fiuu.login');
Route::post('/api/fiuu/logout', [FiuuEcrController::class, 'logout'])->name('fiuu.logout');
Route::post('/api/fiuu/refresh-token', [FiuuEcrController::class, 'refreshToken'])->name('fiuu.refresh');

// Terminal management
Route::get('/api/fiuu/terminals', [FiuuEcrController::class, 'getTerminals'])->name('fiuu.terminals');

// Payment channels
Route::get('/api/fiuu/ewallet-channels', [FiuuEcrController::class, 'getEwalletChannels'])->name('fiuu.channels');

// Transaction routes
Route::post('/api/fiuu/sale', [FiuuEcrController::class, 'sale'])->name('fiuu.sale');
Route::post('/api/fiuu/void', [FiuuEcrController::class, 'void'])->name('fiuu.void');
Route::get('/api/fiuu/get-last', [FiuuEcrController::class, 'getLast'])->name('fiuu.getLast');

// Utility routes
Route::post('/api/fiuu/generate-signature', [FiuuEcrController::class, 'generateSignature'])->name('fiuu.signature');
