<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\APIS\CustomerApi\UserAssetLinkController;
use Tymon\JWTAuth\Facades\JWTAuth;
use App\Http\Controllers\AlarmControllerCommon;
use App\Http\Controllers\APIS\AdminApi\UsersController;
use App\Http\Controllers\APIS\CustomerApi\AuthController;
use App\Http\Controllers\APIS\CustomerApi\CustomerDeviceInfoController;
use App\Http\Controllers\APIS\CustomerApi\TelemetryController;
use App\Http\Controllers\APIS\CustomerApi\DownloadsController as CustomerApiDownloadsController;
use App\Http\Controllers\APIS\CustomerApi\TimeseriesAlertMessageController;

Route::get('/customerapi', function () {
    return ('Welcome to admin api routes.');
});


Route::post('user-login', [AuthController::class, 'login']);

Route::post('/telemetry-data-device-diagnostic', [TelemetryController::class, 'telemePtryDataDeviceDiagnostic']);



// Route::post('/user-login', [AuthController::class, 'login']);
Route::middleware(['customerApiBasicAuth'])->group(function () {
    Route::get('/user-assets-old', [UserAssetLinkController::class, 'index']);
    Route::get('/customer-device-info-old', [CustomerDeviceInfoController::class, 'customerDeviceInfo']);
    Route::get('/user-info', [CustomerDeviceInfoController::class, 'userInfo']);

    Route::post('/telemetry-data-asset', [TelemetryController::class, 'telemetryDataAsset']);
    Route::post('/telemetry-data-device', [TelemetryController::class, 'telemetryDataDevice']);

    Route::post('/store/report', [CustomerApiDownloadsController::class, 'storePdfData'])->name('store-report');
    Route::post('/fetch/report', [CustomerApiDownloadsController::class, 'fetchReport'])->name('fetch-report');
    Route::post('/destroy/report', [CustomerApiDownloadsController::class, 'destroyReport'])->name('destroy-report');

    Route::get('/alert-message/{deviceId}', [TimeseriesAlertMessageController::class, 'alertMessage']);
    Route::post('/store/report', [CustomerApiDownloadsController::class, 'storePdfData'])->name('store-report');
    Route::post('/fetch/report', [CustomerApiDownloadsController::class, 'fetchReport'])->name('fetch-report');
    Route::post('/destroy/report', [CustomerApiDownloadsController::class, 'destroyReport'])->name('destroy-report');

    Route::post('/alarm/filter', [AlarmControllerCommon::class, 'filterAlarm'])->name('alarm.filter');
    Route::post('/alarm', [AlarmControllerCommon::class, 'getDeviceAlarms'])->name('alarm.device');

    // ***************************************** Based on Documentation ***********************************************

    Route::get('/entity-query', [TelemetryController::class, 'entityQuery']);

    Route::get('/user-assets', [TelemetryController::class, 'userAssetsNew']);
    Route::get('/customer-device-info', [TelemetryController::class, 'customerDeviceInfoNew']);
    Route::get('/get-active-devices-list', [TelemetryController::class, 'getActiveDevicesList']);
    Route::get('/get-device-indicators/{assetId}', [TelemetryController::class, 'getDeviceIndicators']);
    Route::get('/get-live-device/{deviceId}', [TelemetryController::class, 'getLiveDevice']);
    Route::get('/get-alerts/{deviceId}', [TelemetryController::class, 'getAlerts']);
    Route::get('/get-global-indicators/{deviceId}', [TelemetryController::class, 'getGlobalIndicators']);
    Route::get('/get-trends/{deviceId}', [TelemetryController::class, 'getTrends']);
    Route::get('/get-cylinder-specific-indicators/{deviceId}', [TelemetryController::class, 'getCylinderSpecificIndicators']);
    Route::get('/get-peak-pressure/{deviceId}', [TelemetryController::class, 'getPeakPressure']);

    // Alarms
    Route::post('/get-user-alarms', [TelemetryController::class, 'getUserAlarms']);
    Route::get('/get-user-device-by-asset/{assetId}', [TelemetryController::class, 'getUserDeviceByAsset']);
    Route::get('/get-user-assets', [TelemetryController::class, 'getUserAssets']);



});

 // user password update
    Route::post('/user-password-update-link', [UsersController::class, 'userEmailCheck']);
    Route::post('/user-password-update', [UsersController::class, 'userUpdatePassword'])->name('user.password.update');

