<?php

use App\Http\Controllers\Agent\AppointmentController;
use App\Http\Controllers\Agent\Auth\LoginController;
use App\Http\Controllers\Agent\DashboardController;
use App\Http\Controllers\Agent\MeetingController;
use Illuminate\Support\Facades\Auth;
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('/', function () {
//     return view('welcome');
// });


Route::any('agent/login-agent', [LoginController::class, 'loginAgent']);
Route::post('agent/registerPost', 'Agent\DashboardController@register')->name('registerPost');
Route::post('agent/verify-email/{id}', 'Agent\DashboardController@emailVerify')->name('verify-email');
Route::post('agent/save-profile/{id}', 'Agent\DashboardController@saveProfile')->name('save-profile');
Route::post('agent/resend-code/{id}', 'Agent\DashboardController@resendCode')->name('resend-code');

Route::group(['prefix' => 'agent', 'namespace' => 'Agent', 'as' => 'agent.', 'middleware' => ['agent_auth']], function () {

    Route::get('register', 'Auth\RegisterController@showRegisterForm')->name('register');


    Route::get('login', 'Auth\LoginController@showLoginForm');
    Route::post('login/post', 'Auth\LoginController@login');

    Route::get('password/request', 'Auth\ResetPasswordController@resetPassword')->name('password.request');

    Route::group(['middleware' => ['auth:agent']], function () {

        Route::post('logout', 'Auth\LoginController@logout')->name('logout');
        Route::get('/', 'HomeController@index')->name('home');
        Route::get('/dashboard', 'DashboardController@index');

        /* Route::get('/join-meeting/{roomName}', [MeetingController::class, 'joinMeeting']); */
        Route::get('/appointments', 'AppointmentController@index')->name('appointments');
        Route::post('api/profile', 'AppointmentController@profile')->name('profile');
        Route::post('api/profile-image-upload/{patient}', 'AppointmentController@profileImageUpload')->name('profileImageUpload');


        Route::get('/delete/appointment/{id}', 'AppointmentController@delete')->name('delete.appointment');

        Route::get('/patient-details/{id}', 'AppointmentController@patientDetails')->name('patient-details');
        Route::post('api/patient-profile-details/{patient}', 'AppointmentController@patientProfileDetails');
        Route::get('/patient-address/{id}', 'AppointmentController@patientAddress')->name('patient-address');
        Route::get('/patient-labs/{id}', 'AppointmentController@patientLabs')->name('patient-labs');
        Route::post('/patient-address/post/{id}', 'AppointmentController@savePatientAddress')->name('patient.address.post');

        Route::post('api/pending-appointment', 'AppointmentController@pendingAppointmentDetail');


        Route::get('/patient-tasks/{id}', 'AppointmentController@patientTasks')->name('patient-tasks');
        Route::post('/patient-tasks/post/{id}', 'AppointmentController@patientTasksSave')->name('patient-tasks.post');
        Route::get('/patient-tasks/delete/{id}', 'AppointmentController@patientTaskDelete')->name('patient-tasks.delete');

        Route::post('api/start-call/{patient_id}/{agent_id}/{appointment_id}', [MeetingController::class, 'startCall'])->name("startCall");
        Route::post('api/end-call/{patient}/{appointment}', [MeetingController::class, 'endCall'])->name("endCall");
        Route::post('api/start-record/{appointment}', [MeetingController::class, 'startRecording'])->name("startRecording");
        Route::post('api/end-call/{patient_id}/{appointment_id}', [MeetingController::class, 'endCall']);
        Route::post('api/labs/search', [MeetingController::class, 'searchLabsByAddress'])->name("searchLabsByAddress");
        Route::post('api/update-patient-info/{patientId}', [MeetingController::class, 'updateInfo']);
        Route::post('api/get-patient-info/{patientId}', [MeetingController::class, 'getInfo']);
        Route::post('api/get-doctors-list', [MeetingController::class, 'getDoctorList']);
        Route::post('api/get-appointment-list', [MeetingController::class, 'getAppointmentList']);
        Route::post('api/book-doc-appointment/post/{id}', [AppointmentController::class, 'doctorAppointmentSave'])->name('book-doc-appointment.post');
        Route::post('api/get-doctors-appointment-list', [MeetingController::class, 'getDoctorAppointmentList']);
        Route::post('api/get-completed-appointment-list', [DashboardController::class, 'getProviderMeetings']);
        Route::post('api/available-slots/{date}', [MeetingController::class, 'availableSlots']);
        Route::post('api/appointment-detail/{appointment}', [MeetingController::class, 'appointmentDetail']);

        Route::post('api/patient-book-lab/post/{appointment}', 'AppointmentController@patientBookLab')->name('patient.book-lab.post');
        Route::post('api/patient-book-lab/get/{appointment}', 'AppointmentController@patientBookLabGet')->name('patient.book-lab.get');

        Route::post('api/questions-list', 'AppointmentController@questionsList')->name('questionsList');
        Route::post('api/questions-answers/{patient_id}/{appointment_id}', 'AppointmentController@questionsAnswers');
        Route::post('api/question-answer/{patient}/{appointment}', 'AppointmentController@storeAnswers')->name('storeAnswers');
        Route::post('api/get-question-answer/{patient}/{appointment}', 'AppointmentController@getQuestions')->name('getQuestions');

        Route::post('api/patient-recording-switch/{agent}/{switch}', 'AppointmentController@switchButton');
        Route::post('api/patient-recording-switch-get/{agent}', 'AppointmentController@switchButtonGet');

        Route::post('api/patient-ai-transcript-switch/{agent}/{switch}', 'AppointmentController@switchAiButton');
        Route::post('api/patient-ai-transcript-switch-get/{agent}', 'AppointmentController@switchAiButtonGet');
        Route::post('api/agent-profile', 'AppointmentController@getProfile');

        Route::post('api/get-analytics/{filter?}', 'AppointmentController@getAnalytics');
        Route::post('api/get-meeting-history/{filter?}', 'AppointmentController@getMeetingHistory');
        Route::post('api/get-history', 'AppointmentController@sessionHistory');
        Route::post('api/add-note/{patient}/{appointment}', 'AppointmentController@addNotePatient');
        Route::post('api/get-note/{patient}/{appointment}', 'AppointmentController@getNotePatient');
        Route::post('api/get-appointment/{patient}/{appointment}', 'AppointmentController@getAppointmentByid');

        Route::post('api/get-profile-categories', [App\Http\Controllers\PatientController::class, 'getProfileCategories']);
        Route::post('api/get-question-builder/{patient}',  'AppointmentController@getQuestionBuilderStore');

        Route::post('api/get-prescriptions', 'AppointmentController@getPrescription');
        Route::post('api/store-prescriptions', 'AppointmentController@storePrescription');
        Route::post('api/update-status-prescriptions/{patient_prescription_id}', 'AppointmentController@updateStatusPrescription');
        Route::post('api/get-status-prescriptions/{patient_prescription_id}', 'AppointmentController@getStatusPrescription');
        Route::post('api/store-patient-prescriptions', 'AppointmentController@storePatientPrescription');
        Route::post('api/get-patient-prescriptions/{patient_id}/{appointment_id}', 'AppointmentController@getPatientPrescription');
        Route::post('api/store-order-data', 'AppointmentController@getOrderData');
        Route::post('api/store-order-data/{cart}', 'AppointmentController@updateStatusOrderData');
        Route::post('api/get-lab-kit/', 'AppointmentController@getLabKit');
        Route::post('api/order-lab-kit/{labkit}/{patient}', 'AppointmentController@orderLabKit');
        Route::post('api/get-order-lab-kit/{labkit}/{patient}', 'AppointmentController@getorderedLabKit');
        Route::post('api/get-order-lab-kit/{patient}', 'AppointmentController@getorderedLabKitBasedOnPatient');
        Route::post('api/device-current-status', 'AppointmentController@DeviceCurrentStatus');
        Route::post('api/appointment-status/{id}', 'MeetingController@markAppointmentsStatus');
        Route::post('api/order-list', 'OrderController@orderList');
        Route::post('api/order-details/{id}', 'OrderController@orderDetails');
        Route::post('api/patient-history/{id}', 'PatientProfileController@index');
        Route::post('api/labkit-order-items', 'PatientProfileController@labkitOrderItemStore');
        Route::post('api/labkit-order-items-get', 'PatientProfileController@labkitOrderItemGet');
        Route::post('api/patient-appointments', 'AppointmentController@PatientAppointment');
    });
});

Route::get('api/questions', 'AppointmentController@questions')->name('questions');
/* Route::post('agent/api/doctor-appointment-booking', [MeetingController::class, 'drAppointmentBooking'])->name("drAppointmentBooking"); */

Route::get('/create-meeting/{meeting_id}', [MeetingController::class, 'show'])->name("createMeeting");
Route::get('/join-meeting/{meeting_id}', [MeetingController::class, 'joinMeeting'])->name("joinMeeting");
Route::post('/get-asseblyai-token', [MeetingController::class, 'getAsseblyAiToekn'])->name("asseblyai-token");
