<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\ApiMerchantsController;
use App\Http\Controllers\ApiDealersController;
/*
|--------------------------------------------------------------------------
| 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:sanctum')->get('/user', function (Request $request) {
//     // dd($request->all());
//     return $request->user();
// });


Route::get('/test', fn() => 'OK');

Route::post('/login', [AuthController::class, 'login']);
// Route::post('/register', [AuthController::class, 'register']);

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

    Route::post('merchant/login', [ApiMerchantsController::class, 'merchant_login']);
    Route::post('merchant/transactions', [ApiMerchantsController::class, 'get_transactions']);
    Route::post('merchant/customertopup', [ApiMerchantsController::class, 'customerTopupStore']);
    Route::post('/logout', [AuthController::class, 'logout']); //will not be needed

    Route::get('merchant/dealers', [ApiMerchantsController::class, 'get_dealers']);
    Route::post('merchant/refund', [ApiMerchantsController::class, 'merchantToDealerRefund']);


    Route::post('dealer/login', [ApiDealersController::class, 'handleLogin']);
    Route::post('dealer/balance', [ApiDealersController::class, 'getBalance']);
    Route::post('dealer/transactions', [ApiDealersController::class, 'getTransactionsJson']);
    Route::post('dealer/activities', [ApiDealersController::class, 'getActivity']);
    Route::post('dealer/topupmerchant', [DealerApiController::class, 'merchantTopupStore']);


    Route::post('dealer_main/topupmerchant', [DealerApiController::class, 'merchantTopupStore']);


    /*
    Route::get('/change-pin', 'MerchantController@showchangepin');
    Route::post('change-pin', 'MerchantController@changePin');

    Route::get('activity', 'MerchantController@getActivity');
    

    */
    
});