<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

// old routes
/*
Route::get('/', function () {
    return view('start');
});

Route::get('/ll-test', function () {
    return view('TEST.sub');
});

Route::get('/join/{meetingID}', function () {
    return view('join');
});

Route::get('/meeting/{meetingID}/{participantID}', 'GuestController@meeting');
*/

Route::middleware('ensureNoValidSession')->group(function(){
    Route::get('/', 'AppSessionController@proRequestSmsLogInToken')->name('pro-request-sms-login-token');
    Route::get('/pro/login', 'AppSessionController@proLogIn')->name('pro-login');
    Route::post('/pro/login', 'AppSessionController@processProLogIn')->name('process-pro-login');
});

Route::middleware('ensureValidSession')->group(function(){
    Route::get('/dashboard', 'ProController@dashboard')->name('pro-dashboard');

    // old routes
//    Route::get("/pros", 'ProController@index')->name('pro-index');
//    Route::get("/pros/create", 'ProController@create')->name('pro-create');
//    Route::get("/pros/show/{uid}", 'ProController@show')->name('pro-show');

    // Route::get('/pro/meeting/{meetingID}', 'ProController@meeting');

    Route::get('/pro/logout', 'AppSessionController@processProLogOut')->name('pro-logout');

    @include 'generated.php';

    Route::get('/mc/{fragment}', 'MeetingCenterController@mc')
        ->where('fragment', '.+')
        ->name('mc');

});

Route::post('/post-to-api', 'AppSessionController@postToAPI')->name('post-to-api');
