<?php

// use App\Http\Controllers\AssetController;

use App\Http\Controllers\APIS\AdminApi\AlarmController;
use App\Http\Controllers\AlarmControllerCommon;
use App\Http\Controllers\APIS\AdminApi\AdminDashboardController;
use App\Http\Controllers\APIS\AdminApi\CustomerController;
use App\Http\Controllers\APIS\AdminApi\UsersController;
use App\Http\Controllers\APIS\AdminApi\DeviceController;
use App\Http\Controllers\APIS\CustomerApi\TelemetryController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\APIS\AdminApi\AssetadmintController;
use App\Http\Controllers\APIS\AdminApi\RuleChainController;
use App\Http\Controllers\APIS\AdminApi\DeviceProfileMasterController;
use App\Http\Controllers\APIS\AdminApi\LoginController;
use App\Http\Controllers\LocationController;
use App\Services\AdminService;

Route::get('/adminapi', function () {
    return ('Welcome to admin api routes.');
});
//******************************************************* Admin Assest API ********************************************************
Route::post('/admin-login', [LoginController::class, 'adminLogin'])->name('admin.login');
Route::get('/admin-dashboard', [AdminDashboardController::class, 'adminDashboard'])->name('admin.dashboard');
Route::get('/get-admin-active-devices-list', [AdminDashboardController::class, 'getAdminActiveDevicesList']);

Route::post('/asset', [AssetadmintController::class, 'storeAssest'])->name('assest.create');
Route::get('/assets-list', [AssetadmintController::class, 'listAssest'])->name('assest.list');
Route::post('/assets-delete', [AssetadmintController::class, 'deleteAsset'])->name('assest.delete');
Route::post('/asset-assign', [AssetadmintController::class, 'assignAssetToUser'])->name('assest.assign');
Route::get('/customer-list', [AssetadmintController::class, 'customerList'])->name('list.custgomer');
Route::get('/assets/{customer_id}', [AssetadmintController::class, 'assestlistCustomer'])->name('assestList.custgomer');


//******************************************************* Customer API********************************************************

Route::post('/customer/create-or-update', [CustomerController::class, 'createOrUpdateCustomer'])->name('customer.create-or-update');
Route::get('/customer/list', [CustomerController::class, 'listCustomers'])->name('customer.list');
Route::post('/customer/delete', [CustomerController::class, 'deleteCustomers'])->name('customer.delete');


//******************************************************* User API********************************************************

Route::post('/users-store', [UsersController::class, 'store'])->name('user_create');
Route::get('/users-list', [UsersController::class, 'list'])->name('user_list');
Route::post('/users-delete', [UsersController::class, 'delete']);
Route::post('/activate/{id}/{token}', [UsersController::class, 'activate'])->name('activate.user');
Route::post('/users-login', [UsersController::class, 'loginUser']);
Route::post('/users-customer-list', [UsersController::class, 'userlistCustomer'])->name('usertList.customer');
Route::get('/users/{customer_id}', [UsersController::class, 'UserByCustomerId'])->name('usertList.customerId');

//******************************************************* Device API********************************************************
Route::post('/device/create-or-update', [DeviceController::class, 'createOrUpdateDevice']);
Route::get('/device/list', [DeviceController::class, 'listDevices'])->name('device.list');
Route::post('/device/delete', [DeviceController::class, 'deleteDevice'])->name('device.delete');
Route::get('/device/{customer_id}', [DeviceController::class, 'devicelistCustomer'])->name('devicetList.customer');


//******************************************************* Admin DeviceProfileMaster API ********************************************************
Route::get('/device-profile-master/list', [DeviceProfileMasterController::class, 'deviceprofileMasterList'])->name('deviceMaster.list');
Route::post('/update-device-profile-master/{deviceId}', [DeviceProfileMasterController::class, 'updateDevice'])->name('update.deviceMaster');


//******************************************************* Alarm API ********************************************************
Route::post('/alarm/create-or-update', [AlarmControllerCommon::class, 'createOrUpdateAlarm'])->name('alarm.create-or-update');
Route::get('/alarm/{id}', [AlarmControllerCommon::class, 'getAlarmById'])->name('get.alarm');
Route::post('/alarm/ack/{id}', [AlarmControllerCommon::class, 'acknowledgeAlarmById'])->name('ack.alarm');
Route::post('/alarm/filter', [AlarmControllerCommon::class, 'filterAlarm'])->name('alarm.filter');
Route::post('/alarm/clear/{id}', [AlarmControllerCommon::class, 'clearAlarmById'])->name('clear.alarm');
Route::post('/get-admin-alarms', [TelemetryController::class, 'getAdminAlarms']);
Route::get('get-device-by-asset/{assetId}', [TelemetryController::class, 'getDeviceByAsset']);

//******************************************************* Rule Chain API ********************************************************
Route::get('/rule-chains', [RuleChainController::class, 'getRuleChainList'])->name('list.RuleChain');
Route::get('/rule-chains-export', [RuleChainController::class, 'exportruleChain'])->name('export.RuleChain');
Route::get('/rule-chains/{ruleChainId}', [RuleChainController::class, 'showruleChain'])->name('show.RuleChain');


Route::get('/countries', [LocationController::class, 'getCountries'])->name('get.country');
// Route::get('/states-by-country-name/{name}', [LocationController::class, 'getState'])->name('get.state');
Route::get('/states-by-country-name', [LocationController::class, 'getState'])->name('get.state');
Route::get('/city-by-state-name', [LocationController::class, 'getCity'])->name('get.city');
