<?php

use App\Http\Controllers\Apps\Memberin\SelfMemberinController;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
use App\Http\Controllers\Apps\ModifiedTransaksi;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\Http\Setup\Gate\MasterGateController;
use App\Http\Controllers\Http\Setup\Gate\MasterGateHardwareController;
use App\Http\Controllers\Http\Setup\Gate\MasterGateParameterController;
use App\Http\Controllers\LostiketController;
use App\Http\Controllers\MemberProductController;
use App\Http\Controllers\MemberStikerController;
use App\Http\Controllers\Operasional\TransaksiParkirController;
use App\Http\Controllers\Report\LaporanStiker;
use App\Http\Controllers\ReportTransaksiController;
use App\Http\Controllers\SetupController;
use App\Http\Controllers\StikerController;
use App\Http\Controllers\StreamerController;
use App\Http\Controllers\Tools\StikerExtendedController;
use App\Http\Controllers\Tools\TransactionChangeController;
use App\Http\Controllers\VerifyTransController;

use App\Services\BcaSignatureTest;

/*
|--------------------------------------------------------------------------
| 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('backend');
// });


Route::get('/', [SetupController::class, 'index']);
Route::post('/setup/run', [SetupController::class, 'run'])->name('setup.run');
Route::resource('/apps', ModifiedTransaksi::class);
Route::post('/scan', [ModifiedTransaksi::class, 'scan'])->name('apps.scan');

Route::resource('memberin', SelfMemberinController::class)->names('self-memberin');


Auth::routes();
Route::group(['middleware' => 'auth'], function () {
    Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');

    Route::prefix('/setup')->group(function () {
        Route::prefix('master')->group(function () {
            Route::resource('gate', MasterGateController::class);
            Route::resource('gate-details', MasterGateParameterController::class);
            Route::resource('gate-hardware', MasterGateHardwareController::class)->names('hardware');
        });
    });

    Route::prefix('/transaksi')->group(function () {
        Route::resource('parkir', TransaksiParkirController::class)->names('transaksiparkir');
        Route::get('stiker', [StikerController::class, 'index']);
        Route::resource('member', MemberStikerController::class);
    });

    Route::prefix('report')->group(function () {
        Route::get('/laporan-semua-transaksi', [ReportTransaksiController::class, 'allReport']);
        Route::get('/laporan-semua-transaksi/data', [ReportTransaksiController::class, 'allReportData'])->name('getData');
        Route::get('/laporan-per-pintu', [ReportTransaksiController::class, 'byGate']);
        Route::get('/laporan-per-pintu/data', [ReportTransaksiController::class, 'gateData'])->name('gateData');

        Route::prefix('stiker')->group(function () {
            Route::get('/harian', [LaporanStiker::class, 'laporanStikerHarian']);
            Route::get('/harian/data', [LaporanStiker::class, 'dataStiker'])->name('stikerData');
        });

    });
    Route::prefix('/tools')->group(function () {
        Route::resource('stiker-extend', StikerExtendedController::class);
        Route::resource('change-trans', TransactionChangeController::class);
    });

    // Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
    Route::resource('verify', VerifyTransController::class);
    Route::post('/verify/show', [VerifyTransController::class, 'showImages']);
    Route::resource('losttiket', LostiketController::class);
    Route::post('member/data', [MemberStikerController::class, 'getMember'])->name('getMember');
    Route::post('member/checkField', [MemberStikerController::class, 'checkField']);
    Route::resource('settings', LostiketController::class);
    Route::resource('settings-register', MemberProductController::class);
    Route::get('streaming', [StreamerController::class, 'index']);
    Route::get('stream-snapshot', [StreamerController::class, 'streamSnapshot']);
});


 Route::get('phpinformation', function () { 
    phpinfo(); 
})->name('phpmyinfo');