<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\AuthController;
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\PreAuthController;
use App\Http\Controllers\EligibilityController;

Route::get('ehr/list', [AuthController::class, 'ehrList'])->name('ehr.list');
Route::get('login/{ehrSlug?}', [AuthController::class, 'login'])->name('login');
Route::any('callback', [AuthController::class, 'callback'])->name('callback');
Route::group(['middleware' => 'auth.ehr', 'prefix' => '/'], function() {
    Route::any('dashboard', [DashboardController::class, 'dashboard'])->name('dashboard');
    Route::any('scribe', [DashboardController::class, 'scribe'])->name('scribe');
    Route::any('pre-auth', [PreAuthController::class, 'preAuth'])->name('pre.auth');
    Route::any('/download-pdf', [PreAuthController::class, 'downloadPDF'])->name('pdf.download')->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
    Route::any('/download-zip', [PreAuthController::class, 'downloadBunchPDF'])->name('zip.download')->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
    Route::any('check-eligibility', [EligibilityController::class, 'checkEligibility'])->name('check.eligibility');
    Route::any('/eob', [EligibilityController::class, 'index'])->name('eob');
    Route::any('/save/settings', [DashboardController::class, 'saveSettings'])->name('save.settings');
    Route::any('/save/session', [EligibilityController::class, 'updateSession'])->name('session.update');
    Route::any('/download-pdf', [DashboardController::class, 'downloadPDF'])->name('pdf.download')->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
    Route::any('/eligibility-pdf', [EligibilityController::class, 'downloadPDF'])->name('download.eligibility')->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
    Route::get('logout', [AuthController::class, 'logout'])->name('logout');
    //Permission denied screen
    Route::get('/permission-denied', function () {
        return view('permission-denied');
    })->name('permission.denied');
});
Route::get('/{customerSlug?}', [AuthController::class, 'checkCustomer'])->where('any', '.*');
