<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\MidtransController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\Api\MeterController;
use App\Http\Controllers\Api\MeterReadingController;
use App\Http\Controllers\Api\InvoiceController;
use App\Http\Controllers\Api\AppSettingController;
use App\Http\Controllers\Api\NewsController;
use App\Http\Controllers\Api\NotificationController;
 

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
*/

Route::post('/midtrans/notification', [MidtransController::class, 'handleNotification'])->name('midtrans.notification');
Route::get('/pelanggan', [UserController::class, 'index']);
Route::get('/pelanggan/{id}', [UserController::class, 'show']);
Route::post('/pelanggan/{id}', [UserController::class, 'update']);
Route::get('/meter-readings', [MeterReadingController::class, 'index']);
Route::get('meter-readings/{id}', [MeterReadingController::class, 'show']);
Route::post('meter-readings/{id}', [MeterReadingController::class, 'update']);
Route::get('/invoices', [InvoiceController::class, 'index']);


Route::get('/upload-status', [AppSettingController::class, 'getStatus']);
Route::post('/upload-status/toggle', [AppSettingController::class, 'toggleStatus']);

Route::get('/news', [NewsController::class, 'index']);
Route::get('/news/{id}', [NewsController::class, 'show']);
Route::post('/news/store', [NewsController::class, 'store']);
Route::post('/news/update/{id}', [NewsController::class, 'update']);
Route::delete('/news/delete/{id}', [NewsController::class, 'destroy']);

Route::post('/notifications/blast', [NotificationController::class, 'sendBlast']);