<?php

use App\Http\Controllers\Auth\LoginController;
use App\Http\Controllers\CheckoutController;
use App\Http\Controllers\HistoryPaymentController;
use App\Http\Controllers\HistorySNCheckController;
use App\Http\Controllers\HomeController;
use App\Http\Controllers\MailController;
use App\Http\Controllers\SerialNumberCheckController;
use App\Http\Controllers\SubscriberController;
use App\Http\Controllers\ShareWithFriendController;
use App\Http\Controllers\UserProfileController;
use Illuminate\Support\Facades\Route;
use Modules\Auth\app\Http\Controllers\ForgotController;


/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------p
|
| 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!
|
*/

Auth::routes(['verify' => true]);
Route::get('logout', [LoginController::class, 'logout']);

// Pages
Route::get('/', [HomeController::class, 'index'])->name('home');

Route::group([
    'prefix' => 'user'
], function() {
    Route::get('/profile', [UserProfileController::class, 'index'])->name('profile');
    Route::post('/update-profile', [UserProfileController::class, 'update'])->name('update-profile');
    Route::get('/change-password', [UserProfileController::class, 'changePassword'])->name('change-password');
    Route::post('/update-password', [UserProfileController::class, 'updatePassword'])->name('update-password');
    Route::get('/history-payment', [HistoryPaymentController::class, 'index'])->name('history-payment.index');
    Route::get('/history-payment/get', [HistoryPaymentController::class, 'get'])->name('history-payment.get');
    Route::post('/subscriber', [SubscriberController::class, 'sendMailToSubscriber'])->name('subscriber');
    Route::post('/share-with-friend', [ShareWithFriendController::class, 'sendMailToShareWithFriend'])->name('share-with-friend');

    Route::group([
        'prefix' => '/history-sn-check'
    ], function() {
        Route::get('/', [HistorySNCheckController::class, 'index'])->name('history-sn-check.index');
        Route::get('/get', [HistorySNCheckController::class, 'get'])->name('history-sn-check.get');
    });
});

Route::group([
    'prefix' => 'checkout'
], function() {
    Route::get('/package/{id}', [CheckoutController::class, 'package'])->name('checkout.package');
    Route::post('/package/{id}', [CheckoutController::class, 'payment'])->name('checkout.payment');
    Route::get('/check-discount', [CheckoutController::class, 'checkDiscountByAjax']);
    Route::get('/calc-total', [CheckoutController::class, 'calcTotalByAjax']);
});

Route::group([
    'prefix' => 'serial-number-check',
], function() {
    Route::get('/', [SerialNumberCheckController::class, 'index'])->name('serial-number-check.index');;
    Route::post('/search', [SerialNumberCheckController::class, 'search'])->name('serial-number-check.search');
    Route::post('/send-report', [SerialNumberCheckController::class, 'sendReportSummary'])->name('serial-number-check.send-report-summary');
});
