<?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!
|
*/

// Start User
Route::group(
    [
        'prefix'    => 'user',
        'as'        => 'user.',

    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'UserController@getAll']);
        Route::get('/find/{data_id}', ['as' => 'find', 'uses' => 'UserController@getSingle']);
        Route::post('/login', ['as' => 'login', 'uses' => 'UserController@postLogin']);
        Route::post('/register', ['as' => 'register', 'uses' => 'UserController@postRegister']);
        Route::post('/forgot-password', ['as' => 'forgotpassword', 'uses' => 'UserController@postForgotPassword']);
        Route::post('/reset-password', ['as' => 'resetpassword', 'uses' => 'UserController@postResetPassword']);
        Route::post('/create-profile', ['as' => 'createprofile', 'uses' => 'UserController@postCreateProfile']);
        Route::post('/update-profile', ['as' => 'updateprofile', 'uses' => 'UserController@postUpdateProfile']);
    }
);
// End User

// Start Tips
Route::group(
    [
        'prefix'    => 'tips',
        'as'        => 'tips.',

    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'TipsController@getAll']);
        Route::get('/find/{data_id?}', ['as' => 'find', 'uses' => 'TipsController@getSingle']);
        Route::post('/like/{data_id?}', ['as' => 'like', 'uses' => 'TipsController@postLike']);
        Route::post('/log', ['as' => 'Log', 'uses' => 'TipsController@postLog']);
    }
);
// End Tips

// Start Trivia
Route::group(
    [
        'prefix'    => 'trivia',
        'as'        => 'trivia.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'TriviaController@getAll']);
        Route::get('/find/{data_id?}', ['as' => 'find', 'uses' => 'TriviaController@getSingle']);
        Route::post('/submit-answer', ['as' => 'submitanswer', 'uses' => 'TriviaController@postSubmitAnswer']);
    }
);
// End Trivia

// Start Transportation
Route::group(
    [
        'prefix'    => 'transportation',
        'as'        => 'transportation.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'TransportationController@getAll']);
        Route::get('/find-by-user/{data_id?}', ['as' => 'find_by_user', 'uses' => 'TransportationController@getByUser']);
        Route::post('/store', ['as' => 'store', 'uses' => 'TransportationController@postStore']);
        Route::post('/update', ['as' => 'store', 'uses' => 'TransportationController@postUpdate']);
        Route::post('/delete', ['as' => 'store', 'uses' => 'TransportationController@delete']);
    }
);
// End Transportation

// Start News
Route::group(
    [
        'prefix'    => 'news',
        'as'        => 'news.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'NewsController@getAll']);
        Route::get('/find/{data_id?}', ['as' => 'find', 'uses' => 'NewsController@getSingle']);
        Route::post('/like/{data_id?}', ['as' => 'like', 'uses' => 'NewsController@postLike']);
        Route::post('/log', ['as' => 'Log', 'uses' => 'NewsController@postLog']);
    }
);
// End News

// Start Kelompok Driver
Route::group(
    [
        'prefix'    => 'kelompokdriver',
        'as'        => 'kelompokdriver.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'KelompokDriverController@getAll']);
    }
);
// End Kelompok Driver

// Start PointLog
Route::group(
    [
        'prefix'    => 'points',
        'as'        => 'points.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'PointLogController@getAll']);
        Route::get('/all/nonevent', ['as' => 'index', 'uses' => 'PointLogController@getNonEvent']);
        Route::get('/all/withevent', ['as' => 'index', 'uses' => 'PointLogController@getWithEvent']);
    }
);
// End PointLog

// Start Message
Route::group(
    [
        'prefix'    => 'message',
        'as'        => 'message.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'MessageController@getAll']);
        Route::get('/find/{data_id?}', ['as' => 'find', 'uses' => 'MessageController@getSingle']);
        Route::get('/count-user-message/{data_id?}', ['as' => 'count_user_message', 'uses' => 'MessageController@countUserMessage']);
        Route::get('/user-view-message/{message_id?}/{user_id?}', ['as' => 'user_view_message', 'uses' => 'MessageController@userViewMessage']);
        Route::get('/find-by-user/{data_id?}', ['as' => 'find_by_user', 'uses' => 'MessageController@getByUser']);
    }
);
// End Message

// Start Travel
Route::group(
    [
        'prefix'    => 'travel',
        'as'        => 'travel.',
    ],
    function () {
        Route::get('/all', ['as' => 'index', 'uses' => 'TravelController@getAll']);
        Route::post('/request', ['as' => 'request', 'uses' => 'TravelController@postRequest']);
        Route::post('/log', ['as' => 'Log', 'uses' => 'TravelController@postLog']);
    }
);
// End Travel

// Start Test
Route::group(
    [
        'prefix'    => 'test',
        'as'        => 'test.',
    ],
    function () {
        Route::post('/hash', ['as' => 'hash', 'uses' => 'TestController@hash']);
    }
);
// End Test
