<?php

use Illuminate\Support\Facades\Route;
use App\Virtual;
use Illuminate\Http\Request;
use Symfony\Component\Console\Input\Input;
/*
|--------------------------------------------------------------------------
| 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!
|
*/

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

   // Authentication Routes...
   Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
   Route::post('login', 'Auth\LoginController@login');
   Route::post('logout', 'Auth\LoginController@logout')->name('logout');
   
   // Registration Routes...
   //Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
   //Route::post('register', 'Auth\RegisterController@register');
   
   // Password Reset Routes...
   //Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
   //Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
   //Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
   //Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/servers', 'ServerController@index');
Route::get('/servers/createESXi', 'ServerController@createESXi');
Route::get('/servers/createHyperV', 'ServerController@createHyper');

Route::get('/servers/{server}/connect', 'ServerController@connect');
Route::post('/servers/storeESXi', 'ServerController@storeESXi');
Route::post('/servers/storeHyper', 'ServerController@storeHyper');

Route::resource('/virtuals', 'VirtualController');
Route::get('/virtuals/{virtual}/allow', 'VirtualController@allow');
Route::get('/virtuals/{virtual}/cancel', 'VirtualController@cancel');
Route::post('/virtuals/{virtual}', 'VirtualController@delete');
Route::get('/search', 'VirtualController@find');
Route::get('/virtuals/{virtual}/editserver', 'VirtualController@editserver');
Route::get('/virtuals/{virtual}/setnetwork', 'VirtualController@setnetwork');
Route::get('/virtuals/{virtual}/storenetwork', 'VirtualController@storenetwork');
Route::get('/virtuals/{virtual}/requestdelete', 'VirtualController@requestdelete');
Route::get('/virtuals/{virtual}/canceldelete', 'VirtualController@canceldelete');
Route::get('/virtuals/{virtual}/delete', 'VirtualController@delete');

Route::get('/virtuals/{virtual}/show', 'VirtualController@show');

Route::get('/users/{user}/promote', 'UserController@promote');
Route::get('/users/{user}/demote', 'UserController@demote');
Route::post('/find', 'UserController@find');

Route::resource('/users','UserController', ['except' => ['show','create','store','destroy']]);
Route::resource('/servers','ServerController');
