<?php

use Illuminate\Support\Facades\Route;

Route::group(['namespace' => 'MoneyTransfer\Core\Http\Controllers', 'middleware' => ['api', 'auth:sanctum'], 'prefix' => 'api'], function (): void {
    
    // Money Transfers
    Route::group(['prefix' => 'transfers'], function () {
        Route::get('', 'TransferController@index');
        Route::post('', 'TransferController@store');
        Route::get('{id}', 'TransferController@show');
        Route::put('{id}/confirm', 'TransferController@confirmReceived');
        Route::delete('{id}', 'TransferController@destroy');
        Route::get('search', 'TransferController@search');
    });

    // Exchange Rates
    Route::group(['prefix' => 'exchange-rates'], function () {
        Route::get('', 'ExchangeRateController@index');
        Route::get('history', 'ExchangeRateController@history');
        Route::get('{from}/{to}', 'ExchangeRateController@getRate');
    });

    // Rate Alerts
    Route::group(['prefix' => 'rate-alerts'], function () {
        Route::get('', 'RateAlertController@index');
        Route::post('', 'RateAlertController@store');
        Route::put('{id}', 'RateAlertController@update');
        Route::delete('{id}', 'RateAlertController@destroy');
    });

    // Analytics
    Route::group(['prefix' => 'analytics'], function () {
        Route::get('dashboard', 'AnalyticsController@dashboard');
        Route::get('reports', 'AnalyticsController@reports');
        Route::get('currency-distribution', 'AnalyticsController@currencyDistribution');
        Route::get('geographic-distribution', 'AnalyticsController@geographicDistribution');
        Route::get('transfer-success-rate', 'AnalyticsController@transferSuccessRate');
        Route::get('average-transfer-amount', 'AnalyticsController@averageTransferAmount');
    });

    // Notifications
    Route::group(['prefix' => 'notifications'], function () {
        Route::get('', 'NotificationController@index');
        Route::put('{id}/read', 'NotificationController@markAsRead');
        Route::put('mark-all-read', 'NotificationController@markAllAsRead');
        Route::delete('{id}', 'NotificationController@destroy');
        Route::get('preferences', 'NotificationController@getPreferences');
        Route::put('preferences', 'NotificationController@updatePreferences');
    });

    // Transfer Scheduling
    Route::group(['prefix' => 'scheduled-transfers'], function () {
        Route::get('', 'ScheduledTransferController@index');
        Route::post('', 'ScheduledTransferController@store');
        Route::put('{id}', 'ScheduledTransferController@update');
        Route::delete('{id}', 'ScheduledTransferController@destroy');
        Route::post('{id}/execute', 'ScheduledTransferController@execute');
    });
}); 