<?php

use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'booking', 'as' => 'booking.', 'namespace' => 'Bookings'], function () {
    Route::get('/show/{marking}', 'FetchBookingController@fetch')->name('show');
    Route::get('/list', 'ListBookingsController@list')->name('list');
    Route::post('/create', 'CreateBookingController@create')->name('create');
    Route::put('/update/{id}', 'UpdateBookingController@update')->name('update');
    Route::put('/cancel/{id}', 'CancelBookingController@cancel')->name('cancel');
    Route::put('/restore/{id}', 'RestoreBookingController@restore')->name('restore');
    Route::delete('/delete/{id}', 'DeleteBookingController@delete')->name('delete');
    Route::post('/regenerate/invoice/{id}', 'RegenerateInvoiceBookingController@regenerate')->name('regenerate.invoice');

    Route::group(['prefix' => '{id}/payment', 'as' => 'payment.'], function () {
        Route::post('quotation', 'FetchBookingPaymentQuotationController@fetch')->name('quotation');
        Route::post('create', 'CreateBookingPaymentController@create')->name('create');
        Route::post('{payment_id}/verification/create', 'CreatePaymentVerificationController@create')->name('verification.create');
        Route::put('/{payment_id}/approval/{status}', 'ApprovePaymentVerificationController@approve')->where('status', 'approve|reject')->name('approval');
    });

    Route::group(['prefix' => '{id}/refund', 'as' => 'refund.'], function () {
        Route::post('{payment_id}/create', 'CreateBookingRefundController@create')->name('create');
        Route::post('{payment_id}/credit_note/create', 'CreateBookingRefundCreditNoteController@create')->name('credit_note.create');
    });

    Route::post('{id}/purchase_order/verification', 'ApprovePurchaseOrderController@approve')->name('po.approval');

    Route::put('{id}/updateAmount', 'UpdateBookingAmountController@update')->name('booking_amount.update');

    Route::post('/merge', 'MergeBookingController@merge')->name('merge');

    Route::post('{id}/proforma/create', 'CreateProformaInvoiceTransaction@create')->name('proforma.create');

});