<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Master\CabangController;
use App\Http\Controllers\Backend\DashboardController;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

// Route::middleware('auth:api')->get('/user', function (Request $request) {
//     return $request->user();
// });

Route::middleware(['auth:admin', 'menu'])->group(function () {
	Route::get('/api/notifications', [DashboardController::class, 'notifications']);
	Route::get('/api/mark_read/{id}', [DashboardController::class, 'mark_read']);

	Route::get('/api/cabang-by-region/{regionCode}', [CabangController::class, 'getCabangByRegion']);
	Route::get('/api/rayon-by-cabang/{cabangCode}', [CabangController::class, 'getRayonByCabang']);

	Route::get('/api/cabang-by-regionId/{regionId}', [CabangController::class, 'getCabangByRegionId']);
	Route::get('/api/rayon-by-cabangId/{cabangId}', [CabangController::class, 'getRayonByCabangId']);
});