<?php

use App\Http\Controllers\CharacteristicsController;
use App\Http\Controllers\EquipmentMasterController;
use App\Http\Controllers\InvoiceValidationController;
use App\Http\Controllers\MachineController;
use App\Http\Controllers\MfmParameterController;
use App\Http\Controllers\ModuleChartController;
use App\Http\Controllers\ModuleController;
use App\Http\Controllers\ModuleFGLineController;
use App\Http\Controllers\ModuleFilterController;
use App\Http\Controllers\ModuleFilterDataController;
use App\Http\Controllers\ModuleGuardDayCountController;
use App\Http\Controllers\ModuleGuardHourlyCountController;
use App\Http\Controllers\ModuleGuardNameController;
use App\Http\Controllers\ModuleInvoiceDataController;
use App\Http\Controllers\ModuleInvoiceQuantityController;
use App\Http\Controllers\ModuleInvoiceTypeController;
use App\Http\Controllers\ModulePlantController;
use App\Http\Controllers\ModulePlantLineController;
use App\Http\Controllers\ModuleProductionFGLineController;
use App\Http\Controllers\ModuleProductionLineStopController;
use App\Http\Controllers\ModuleProductionOrderDataController;
use App\Http\Controllers\ObdController;
use App\Http\Controllers\PalletController;
use App\Http\Controllers\PalletPrintController;
use App\Http\Controllers\PdfController;
use App\Http\Controllers\PlantController;
use App\Http\Controllers\ProductionStickerReprintController;
use App\Http\Controllers\SapFileController;
use App\Http\Controllers\StickerMasterController;
// use App\Http\Controllers\TelegramController;
use App\Http\Controllers\TestingPanelController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VehicleController;
// use App\Http\Controllers\VehicleController;
// use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
// use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

// Route::get('/user', function (Request $request) {
//     // return "test";

//    $item = \App\Models\Item::get();

//    return $item;
// });

// Route::post('/user/update', function (Request $request) {
//     // Return the request data as JSON
//     // dd($request);
//     return response()->json([
//         'message' => 'User updated successfully',
//         'data' => $request->all()
//     ]);
// });

// Route::middleware('auth.basic')->post('/user/update', function (Request $request) {
//     return response()->json([
//         'message' => 'Authenticated via Basic Auth',
//         'user' => $request->user(),
//         'data' => $request->all()
//     ]);
// });

// OBD

Route::get('obd/get-test-datas', [ObdController::class, 'get_test']);

Route::get('obd/get-data', [ObdController::class, 'get_obd']);

Route::post('obd/store-data', [ObdController::class, 'store_obd']);

// Plant

Route::get('plant/get-all-data', [PlantController::class, 'get_all_data']);

// Sticker Master Model Type

Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get_master_type']);

Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf');

Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf');

Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');

// Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->where('palletNo', '.*')->name('download-qr1-pdf');
Route::get('/download-qr1-pdf', [ProductionStickerReprintController::class, 'downloadQrPdf'])
    ->name('download-qr1-pdf');

// Production Dashboard Controller

Route::get('get/module-name/data', [ModuleController::class, 'get_module']);

Route::get('get/modulechart-name/data', [ModuleChartController::class, 'get_moduleChart']);

Route::get('get/moduleplant-name/data', [ModulePlantController::class, 'get_modulePlant']);

Route::get('get/module-plantline-name/data', [ModulePlantLineController::class, 'get_modulePlantLine']);

Route::get('get/module-line-filter-name/data', [ModuleFilterController::class, 'get_moduleFilter']);

Route::get('get/module-fgline-filter-list/data', [ModuleProductionFGLineController::class, 'get_moduleFGFilterList']);

Route::get('get/module-fgline-filter-name/data', [ModuleFGLineController::class, 'get_moduleFGFilter']);

Route::get('get/module-filter-value/data', [ModuleFilterDataController::class, 'get_moduleFilterData']);

Route::get('get/module-production-order/data', [ModuleProductionOrderDataController::class, 'get_moduleProductionOrder']);

Route::get('get/module-production-linestop/data', [ModuleProductionLineStopController::class, 'get_moduleProductionLineStop']);

// Invoice Dashboard Controller

Route::get('get/module-invoice-type/data', [ModuleInvoiceDataController::class, 'get_invoiceData']);

Route::get('get/module-invoice-filter/data', [ModuleInvoiceTypeController::class, 'get_invoiceFilter']);

Route::get('get/module-invoice-count/data', [ModuleInvoiceTypeController::class, 'get_invoiceCountData']);

Route::get('get/module-invoice-quantity/data', [ModuleInvoiceQuantityController::class, 'get_invoiceQuantityData']);

// Guard Dashboard Controller

Route::get('get/module-guard-day/data', [ModuleGuardDayCountController::class, 'get_guardDay_countData']);

Route::get('get/module-guard-hourly/data', [ModuleGuardHourlyCountController::class, 'get_guardDay_hourlyData']);

Route::get('get/module-guard-name/data', [ModuleGuardNameController::class, 'get_guard_name_Data']);

// Power house controller

Route::get('get/mfm-parameter/data', [MfmParameterController::class, 'get_mfm_parameter']);

Route::get('get/mfm-parameterid/data', [MfmParameterController::class, 'get_mfm_parameterid']);

// Invoice Validation Controller

Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 'serialInvoice']);

Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);

// User Controller

Route::get('user/get-data', [UserController::class, 'get_user_data']);

// Testing panel Controller

Route::get('testing/user/get-data', [UserController::class, 'get_user_data']);

Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_motor_master']);

Route::get('machine/get-all-data', [MachineController::class, 'get_all_data']);

Route::get('machine/get-data', [MachineController::class, 'get_data']);

Route::get('testing/equipment/get-master-data', [EquipmentMasterController::class, 'equipmentMasterData']);

Route::post('testing/reading/store-data', [TestingPanelController::class, 'storeReadings']);

Route::post('testing/leak-test/store-data', [TestingPanelController::class, 'storeLeakTestStatus']);

Route::post('testing/leak-test/get-data', [TestingPanelController::class, 'getLeakTestStatus']);

Route::get('get-pdf', [PdfController::class, 'getPdf']); // processorder/get-pdf

// ..Part Validation - Characteristics

Route::get('laser/item/get-quality-master-data', [StickerMasterController::class, 'get_quality_master']);

// ..Part Validation - Characteristics

Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);

// ..Laser Route to SAP

Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)

// ..Job or Serial - Characteristics

Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);

// ..Job or Serial - Status

Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);

// ..Job or Master - Characteristics

Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);

// ..Marked serial (auto or manual)

Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);

// ..Request Characteristics

Route::post('laser/characteristics/change', [CharacteristicsController::class, 'storeLaserRequestChar']);

Route::get('laser/characteristics/request', [CharacteristicsController::class, 'getLaserRequestChar']);

Route::post('laser-doc-pdf', [PdfController::class, 'storeLaserPdf']);

// ..Process Order

Route::get('process-order/details', [PdfController::class, 'getProcessOrderData']);

Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);

Route::get('sap/files', [SapFileController::class, 'readFiles']);

// ..Product Characteristics

Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);

Route::get('characteristics/get/master', [CharacteristicsController::class, 'getCharMaster']); // LIVEEEE

Route::post('characteristics/values', [CharacteristicsController::class, 'storeCharValues']);

// GR Master PDF and Serial Number

Route::get('grNumber-pdf', [PdfController::class, 'getGRPdf']);

Route::get('grmaster-sno', [PdfController::class, 'getGRSerial']);

Route::post('grmaster-sno-update', [PdfController::class, 'updateGR']);

Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');

// routes/api.php

// Route::post('/characteristic/hold-save', [CharacteristicApprovalController::class, 'holdSave']);

// Route::post('send-telegram', [TelegramController::class, 'sendMessage']);

// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);

Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');

Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);

// ..Item Code

Route::get('item-code', [PlantController::class, 'getItemCode']);
