<?php

use App\Http\Controllers\Agent\MeetingController;
use App\Http\Controllers\Auth\ForgotPasswordController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "api" middleware group. Make something great!
|
*/

Route::any('/register-patient', [App\Http\Controllers\PatientController::class, 'registerPatient']);
Route::any('/login-patient', [App\Http\Controllers\PatientController::class, 'loginPatient']);
Route::post('/forgot-password', [App\Http\Controllers\Auth\ForgotPasswordController::class, 'forgotPassword']);
Route::post('/password-reset', [App\Http\Controllers\Auth\ForgotPasswordController::class, 'resetPassword']);
Route::post('/get-patient-detail/{patient}', [App\Http\Controllers\PatientController::class, 'getPatient']);
Route::post('/plans', [App\Http\Controllers\PatientController::class, 'getPlans']);
Route::post('/plans/{plan}', [App\Http\Controllers\PatientController::class, 'getPlansById']);
Route::post('/plans-product-update', [App\Http\Controllers\PatientController::class, 'planProductUpdate']);
Route::post('/plans-product-sync', [App\Http\Controllers\PatientController::class, 'planProductUpdateMultiple']);
Route::post('/get-product-categories', [App\Http\Controllers\PatientController::class, 'getProductCategories']);

Route::post('/settings', [App\Http\Controllers\PatientController::class, 'getSetting']);
Route::post('/check-email', [App\Http\Controllers\PatientController::class, 'checkEmail']);
Route::post('/get-lab-kit', [App\Http\Controllers\PatientController::class, 'getLabKit']);


Route::any('calendly/get-available-date-schedule', 'App\Http\Controllers\Admin\Api\CalendlyController@getAvailabeSlotDates');
Route::any('calendly/get-available-times-schedule', 'App\Http\Controllers\Admin\Api\CalendlyController@getAvailableDates');
Route::any('calendly/book-schedular', 'App\Http\Controllers\Admin\Api\CalendlyController@bookSchedule');


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

    Route::post('/store-patient-plan', [App\Http\Controllers\PatientController::class, 'storePatientPlan']);
    Route::post('/get-patient-plan', [App\Http\Controllers\PatientController::class, 'getPatientPlan']);

    Route::post('/available-slots/{date}', [App\Http\Controllers\PatientController::class, 'availableSlots']);
    Route::post('/update-patient-detail', [App\Http\Controllers\PatientController::class, 'updatePatient']);
    Route::post('/update-patient/{id}', [App\Http\Controllers\PatientController::class, 'editPatient']);
    Route::post('/change-password', [App\Http\Controllers\PatientController::class, 'updatePassword']);
    Route::post('/book-appointment', [App\Http\Controllers\PatientController::class, 'bookAppointment']);
    Route::post('/appointment-detail/{appointment}', [App\Http\Controllers\PatientController::class, 'appointmentDetail']);

    Route::post('/queue/patient/{patientId}', [App\Http\Controllers\PatientController::class, 'addPatientToQueue']);
    Route::get('/appointments/{patientId}', [App\Http\Controllers\PatientController::class, 'getAppointmentsByPatientId']);
    Route::get('/doctor-appointments/{patientId}', [App\Http\Controllers\PatientController::class, 'getDoctorAppointmentsByPatientId']);
    Route::get('/patient-book-lab/get/{appointment}', [App\Http\Controllers\PatientController::class, 'patientBookLabGet']);
    /* Route::post('/patient-recording-switch/{patient}/{switch}', [App\Http\Controllers\PatientController::class, 'switchButton']);
    Route::post('/patient-recording-switch-get/{patientId}', [App\Http\Controllers\PatientController::class, 'switchButtonGet']); */

    Route::post('/medical-history-question-get/{patient}', [App\Http\Controllers\PatientController::class, 'getMedicalHistoryQuestion']);
    Route::post('/medical-history-question-post/{patient}', [App\Http\Controllers\PatientController::class, 'postMedicalHistoryQuestion']);
    Route::post('/store-order-data/{labkit}', [App\Http\Controllers\PatientController::class, 'storeOrderData']);
    Route::post('/subscription-list-data', [App\Http\Controllers\PatientController::class, 'getSubscriptionList']);
    Route::post('/get-patient-labkits', [App\Http\Controllers\PatientController::class, 'getPatientLabKits']);
    Route::post('/subscription-cancel/{subscription}', [App\Http\Controllers\PatientController::class, 'cancelSubscription']);


    #Route::post('/store-order-data/{labkit}', [App\Http\Controllers\PatientController::class, 'storeOrderData']);

    Route::post('/get-stored-order-data/{cart}', [App\Http\Controllers\PatientController::class, 'getOrderData']);

    Route::post('/appointments-data', [App\Http\Controllers\PatientController::class, 'getPatientAppointmentsWithCartsAndItems']);

    Route::post('/update-status-order-data/{cart}', [App\Http\Controllers\PatientController::class, 'updateStatusOrderData']);
    Route::post('/process-payment', [App\Http\Controllers\PatientController::class, 'processPayment']);
    Route::post('/agent-appointment-detail/{appointment}', [App\Http\Controllers\PatientController::class, 'getAgentAppointment']);
    Route::post('/agent-last-appointment-detail/{patient}', [App\Http\Controllers\PatientController::class, 'getAgentLastAppointment']);

    Route::post('/save-plan/{patient}', [App\Http\Controllers\PatientController::class, 'savePlan']);
    Route::post('/save-patient-plan/{plan}', [App\Http\Controllers\PatientController::class, 'savePatientPlan']);

    Route::post('/get-plan-by-id/{plan}', [App\Http\Controllers\PatientController::class, 'getPlanById']);
    Route::post('/get-plan-by-patient/{patient}', [App\Http\Controllers\PatientController::class, 'getPlanByPatientId']);

    Route::post('/questions-answers/{patient_id}/', [App\Http\Controllers\PatientController::class, 'questionsAnswers']);

    Route::post('/patients/upload-profile-picture', [App\Http\Controllers\PatientController::class, 'uploadProfilePicture'])->name('patient.profile-picture.upload');


    Route::post('/create-profile-categories', [App\Http\Controllers\PatientController::class, 'createProfileCategories']);
    Route::post('/profile-categories/{id}', [App\Http\Controllers\PatientController::class, 'profileCategories']);
    Route::post('/get-profile-categories', [App\Http\Controllers\PatientController::class, 'getProfileCategories']);

    Route::post('/get-groups-by-category/{category_id}', [App\Http\Controllers\PatientController::class, 'getGroupByCategory']);
    Route::post('/get-question-by-group/{group_id}', [App\Http\Controllers\PatientController::class, 'getQuestionByGroup']);


    // Get all profile groups
    // Route::post('/get-profile-categories', [App\Http\Controllers\PatientController::class, 'getProfileCategories']);

    // Create a profile group
    /* Route::post('/create-profile-question/{category_id}', [App\Http\Controllers\PatientController::class, 'createProfileGroups']); */

    // Get a single profile group
    Route::post('/get-profile-question/{category_id}', [App\Http\Controllers\PatientController::class, 'getProfileQuestion']);
    Route::post('/get-profile-sub-question/{category_id}/{question_id}', [App\Http\Controllers\PatientController::class, 'getProfileSubQuestion']);
    Route::post('/get-profile-sub-sub-question/{category_id}/{question_id}/{sub_question_id}', [App\Http\Controllers\PatientController::class, 'getProfileSubSubQuestion']);

    // Get all profile questions
    /* Route::get('/get-profile-questions', [App\Http\Controllers\PatientController::class, 'getProfileQuestion']);

    // Create a profile question
    Route::post('/create-profile-questions', [App\Http\Controllers\PatientController::class, 'createProfileQuestion']);

    // Get a single profile question
    Route::get('/get-one-profile-questions/{id}', [App\Http\Controllers\PatientController::class, 'getOneProfileQuestion']); */
    Route::post('/create-answers-questions', [App\Http\Controllers\PatientController::class, 'createProfileQuestion']);
    Route::post('/create-question-builder/{category}', [App\Http\Controllers\PatientController::class, 'questionBuilderStore']);
    Route::post('/patients-prescriptions/{appointment}', [App\Http\Controllers\PatientController::class, 'getPatientPrescriptions']);
    Route::post('/update-patient-prescription-status/{prescription}', [App\Http\Controllers\PatientController::class, 'updatePrescriptionStatus']);

    Route::post('/get-history', [App\Http\Controllers\PatientController::class, 'sessionHistory']);
    Route::post('/get-note/{appointment}', [App\Http\Controllers\PatientController::class, 'getNotePatient']);
    Route::post('/get-appointment-detail/{appointment}', [App\Http\Controllers\PatientController::class, 'getAppointmentDetail']);
    Route::post('get-patient-prescriptions/{appointment_id}', [App\Http\Controllers\PatientController::class, 'getPatientPrescription']);
    Route::post('get-question-builder', [App\Http\Controllers\PatientController::class, 'getQuestionBuilderStore']);
    Route::post('delete-patient-record', [App\Http\Controllers\PatientController::class, 'deletePatientRecord']);
    Route::post('order-list', [App\Http\Controllers\OrderController::class, 'orderList']);
    Route::post('order-details/{id}', [App\Http\Controllers\OrderController::class, 'orderDetails']);
    Route::post('subscription-list', [App\Http\Controllers\OrderController::class, 'subscriptionList']);
    Route::post('subscription-detail/{id}', [App\Http\Controllers\OrderController::class, 'getSubscriptionDetails']);
    Route::post('patient-profile', [App\Http\Controllers\ProfileController::class, 'profileDetails']);
    Route::post('update-profile', [App\Http\Controllers\ProfileController::class, 'UpdateProfile']);
    Route::post('reset-password', [App\Http\Controllers\ProfileController::class, 'resetPassword']);
    Route::post('change-profile-image', [App\Http\Controllers\ProfileController::class, 'changeProfileImage']);
    Route::post('patient-shipping-activity', [App\Http\Controllers\OrderController::class, 'getPatientShippingActivity']);

    Route::post('/get-stored-latest-order-data', [App\Http\Controllers\PatientController::class, 'getLatestOrderData']);
    Route::post('/get-notification', [App\Http\Controllers\PatientController::class, 'getNotification']);
    Route::post('/get-stats', [App\Http\Controllers\ProfileController::class, 'getStats']);
    Route::post('/labkit-order-items-get', [App\Http\Controllers\ProfileController::class, 'labkitOrderItemGet']);
});

Route::any('/lab-address', [App\Http\Controllers\PatientController::class, 'getLabcorpData']);
Route::any('update-patient-appointment-analysis/{appointment}', [App\Http\Controllers\PatientController::class, 'updateMeetingAnalysis']);
Route::any('ai-flag-analysis/{appointment}', [App\Http\Controllers\PatientController::class, 'aiFlagCheck']);

Route::group(['prefix' => 'api/openerm', 'namespace' => 'OpenErm\Api', 'as' => 'api.openerm.'], function () {

    Route::post('/get-patients', [App\Http\Controllers\OpenErm\PatientController::class, 'getPatientList']);
    Route::post('/get-patient/{puuid}', [App\Http\Controllers\OpenErm\PatientController::class, 'getPatientById']);
    Route::post('/register-patient', [App\Http\Controllers\OpenErm\PatientController::class, 'registerPatient']);
});
