<?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 and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::get('/', [\App\Http\Controllers\HomeController::class, 'index'])
    ->name('home');
Route::post('/', [\App\Http\Controllers\HomeController::class, 'indexPost']);
    
Route::get('/news', [\App\Http\Controllers\NewsController::class, 'index'])
    ->name('news');
Route::get('/news/detail/{id}', [\App\Http\Controllers\NewsController::class, 'detail'])
    ->name('news-detail');

Route::get('/events', [\App\Http\Controllers\EventsController::class, 'index'])
    ->name('events');
Route::get('/events/detail/{id}', [\App\Http\Controllers\EventsController::class, 'detail'])
    ->name('events-detail');

Route::get('/about', [\App\Http\Controllers\AboutController::class, 'index'])
    ->name('about');

Route::get('/support/customer', [\App\Http\Controllers\SupportTechnicalController::class, 'index'])
    ->name('support/customer');
Route::post('/support/customer', [\App\Http\Controllers\SupportTechnicalController::class, 'indexPost']);

Route::get('/support/sales-inquiry', [\App\Http\Controllers\SupportSalesInquiryController::class, 'index'])
    ->name('support/sales-inquiry');
Route::post('/support/sales-inquiry', [\App\Http\Controllers\SupportSalesInquiryController::class, 'indexPost']);

Route::get('/support/distribution-partners', [\App\Http\Controllers\SupportDistributionPartnersController::class, 'index'])
    ->name('support/distribution-partners');

Route::get('/support/ecosystem-partners', [\App\Http\Controllers\SupportEcosystemPartnersController::class, 'index'])
    ->name('support/ecosystem-partners');

//Route::get('/products', [\App\Http\Controllers\ProductsController::class, 'index'])
//    ->name('products');
Route::get('/products', function () {
    return redirect('https://ec.coreality-inc.com');
});


Route::get('/products/detail/{product}', [\App\Http\Controllers\ProductsController::class, 'detail']);
Route::get('/products/{catalogs?}', [\App\Http\Controllers\ProductsController::class, 'catalogs'])
    ->where('catalogs','^[a-zA-Z0-9-_\/]+$');

Route::group(['middleware' => ['guest']], function(){
    /**
     * Register Routes
     */
    //Route::get('/member/register', [\App\Http\Controllers\RegisterController::class, 'show'])->name('register.show');
    //Route::post('/member/register', [\App\Http\Controllers\RegisterController::class, 'register'])->name('register.perform');

    /**
     * Login Routes
     */
    //Route::get('/member/login', [\App\Http\Controllers\LoginController::class, 'show'])->name('login.show');
    Route::get('/member/login', function () {
        return redirect('https://ec.coreality-inc.com/my-account/');
    });
    //Route::post('/member/login', [\App\Http\Controllers\LoginController::class, 'login'])->name('login.perform');
});

Route::group(['middleware' => ['auth']], function() {
    /**
     * Logout Routes
     */
    Route::get('/member/logout',  [\App\Http\Controllers\LogoutController::class, 'perform'])->name('logout.perform');
});