<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| 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::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function () {

    require __DIR__ . '/account.php';

    Route::group(['middleware' => 'valid.token'], function () {

        Route::get('/storage/{fileName}/fetch', 'Documents\RenderDocumentController@fileStorageServe')->where(['fileName' => '.*'])->name('storage.document.file');

        require __DIR__ . '/company.php';

        require __DIR__ . '/document.php';

        require __DIR__ . '/bank.php';

        require __DIR__ . '/currency.php';

        require __DIR__ . '/address.php';

        require __DIR__ . '/transaction.php';

        require __DIR__ . '/receipt.php';

        require __DIR__ . '/order.php';

        require __DIR__ . '/packing_list.php';

        require __DIR__ . '/remark.php';

        require __DIR__ . '/transport.php';

        require __DIR__ . '/schedule.php';

        require __DIR__ . '/segment.php';

        Route::get('/report/sales', 'Reports\MonthlyReportController@salesReport')->name('report.sales');
        Route::get('/report/customer/{marking}/{from?}/{to?}', 'Reports\MonthlyReportController@customerReport')->name('report.customer');
        Route::get('/report/sales/{from?}/{to?}', 'Reports\MonthlyReportController@salesReport')->name('report.sales');
        Route::get('/report/profit/{model}/{value}/{from?}/{to?}', 'Reports\MonthlyReportController@profitModelReport')->name('report.profit');
        Route::get('/report/service', 'Reports\MonthlyReportController@serviceReport')->name('report.service');

    });
});
