<?php

use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Route;
use Mtc\Plugins\Wisebee\Http\Controllers\WisebeeController;
use Mtc\Plugins\Wisebee\Http\Controllers\Admin\WisebeeController as WisebeeAdminController;
use Mtc\Plugins\Wisebee\Http\Controllers\Admin\WisebeeSetupController;
use Mtc\Plugins\Wisebee\Http\Controllers\Admin\WisebeeRemoteSettingsController;

Route::get('book-a-consultation', [WisebeeController::class, 'book'])
    ->name('wisebee-book');
Route::get('video-consultation', [WisebeeController::class, 'video'])
    ->name('wisebee-consultation');
Route::any('wisebee-webhook', [WisebeeController::class, 'webhook'])
    ->name('wisebee-webhook');

Route::group([
    'prefix' => 'members',
    'middleware' => 'account.verified',
], function () {

    Route::get('consultations', [WisebeeController::class, 'memberConsultations'])
        ->name('members-consultations');
});

Route::group([
    'middleware' => 'auth',
    'prefix' => 'admin/wisebee',
], function () {
    Route::get('document/{id}', function ($id) {
        return App::make(WisebeeAdminController::class)->downloadDocument($id);
    })
        ->name('wisebee-document-download');
    Route::get('configuration', [WisebeeAdminController::class, 'configuration'])
        ->name('wisebee-admin-configuration');
    Route::post('configuration', [WisebeeAdminController::class, 'configurationStore'])
        ->name('wisebee-admin-configuration-store');
    Route::get('consultations', [WisebeeAdminController::class, 'consultations'])
        ->name('wisebee-admin-consultations');

    Route::get('setup', [WisebeeSetupController::class, 'index'])
        ->name('wisebee-admin-setup');
    Route::get('setup/industries', [WisebeeSetupController::class, 'industries'])
        ->name('wisebee-admin-setup-industries');
    Route::post('setup/provision', [WisebeeSetupController::class, 'provision'])
        ->name('wisebee-admin-setup-provision');
    Route::post('setup/configure', [WisebeeSetupController::class, 'configureSettings'])
        ->name('wisebee-admin-setup-configure');
    Route::post('setup/upload-logo', [WisebeeSetupController::class, 'uploadLogo'])
        ->name('wisebee-admin-setup-upload-logo');

    Route::get('remote-settings', [WisebeeRemoteSettingsController::class, 'index'])
        ->name('wisebee-admin-remote-settings');
    Route::post('remote-settings', [WisebeeRemoteSettingsController::class, 'store'])
        ->name('wisebee-admin-remote-settings-store');
    Route::post('remote-settings/upload-logo', [WisebeeRemoteSettingsController::class, 'uploadLogo'])
        ->name('wisebee-admin-remote-settings-upload-logo');
});
