<?php

use App\Http\Controllers\CustomScheduleController;
use Illuminate\Support\Facades\Route;

Route::get('/custom-schedule',         [CustomScheduleController::class, 'index'])->middleware('permission:config.custom_schedule,view');
Route::get('/custom-schedule/{id}',    [CustomScheduleController::class, 'show'])->middleware('permission:config.custom_schedule,view');
Route::post('/custom-schedule',        [CustomScheduleController::class, 'store'])->middleware('permission:config.custom_schedule,add');
Route::put('/custom-schedule/{id}',    [CustomScheduleController::class, 'update'])->middleware('permission:config.custom_schedule,edit');
Route::delete('/custom-schedule/{id}', [CustomScheduleController::class, 'destroy'])->middleware('permission:config.custom_schedule,delete');

Route::get('/schedules/grouped-by-client/custom', [CustomScheduleController::class, 'groupedByClientCustom']);

Route::get('/custom-schedule-available',              [CustomScheduleController::class, 'available'])->middleware('permission:config.custom_schedule,view');
Route::get('/custom-schedule-provider-proposals',     [CustomScheduleController::class, 'providerProposals'])->middleware('permission:config.custom_schedule,view');
Route::get('/custom-schedule/{scheduleId}/proposals', [CustomScheduleController::class, 'opportunityProposals'])->middleware('permission:config.custom_schedule,view');
Route::post('/custom-schedule/{scheduleId}/propose',  [CustomScheduleController::class, 'propose'])->middleware('permission:config.custom_schedule,add');
Route::post('/custom-schedule/{proposalId}/accept',   [CustomScheduleController::class, 'acceptProposal'])->middleware('permission:config.custom_schedule,edit');
Route::post('/custom-schedule/{proposalId}/refuse',   [CustomScheduleController::class, 'refuseProposal'])->middleware('permission:config.custom_schedule,delete');

Route::post('/custom-schedule/{scheduleId}/refuse-opportunity', [CustomScheduleController::class, 'refuseOpportunity'])->middleware('permission:config.custom_schedule,delete');

Route::get('/custom-schedule-proposals-provider/{providerId}', [CustomScheduleController::class, 'getProvidersProposalsAndOpportunities'])->middleware('permission:config.custom_schedule,view');
Route::post('/custom-schedule-verify-code/{scheduleId}',       [CustomScheduleController::class, 'verifyCode'])->middleware('permission:config.custom_schedule,edit');