<?php

use Illuminate\Support\Facades\Route;

Route::group(['namespace' => 'PackingLists', 'as' => 'packing_list.', 'prefix' => 'packing_list'], function () {
    Route::get('/{id}/show', 'FetchPackingListController@fetch')->name('show');
    Route::get('/list', 'ListPackingListsController@list')->name('list');
    Route::post('/create', 'CreatePackingListController@create')->name('create');
    Route::post('/create/deliver', 'CreateDeliverPackingListController@create')->name('create.deliver');

    Route::put('/update/{id}', 'UpdatePackingListController@update')->name('update');
    Route::put('/status/{id}/update/{status}', 'UpdatePackingListStatusController@update')->name('status.update');
    Route::delete('/delete/{id}', 'DeletePackingListController@delete')->name('delete');

    Route::put('/reschedule/{id}', 'ReschedulePackingListController@reschedule')->name('reschedule');
    Route::put('/update-dispatch-date/{id}', 'UpdateDispatchDatePackingListController@update')->name('update_dispatch_date');
    Route::put('/update-drop-date/{id}', 'UpdateDropDatePackingListController@update')->name('update_drop_date');
    Route::put('/complete/{id}', 'CompletePackingListController@complete')->name('complete');
    Route::put('/assign-remark/{id}', 'AssignPackingListRemarkController@create')->name('assign.remark');

    Route::group(['namespace' => 'Containers', 'prefix' => 'container', 'as' => 'container.'], function () {
        Route::get('/{id}/show', 'FetchContainerController@fetch')->name('show');
        Route::get('/list', 'ListContainersController@list')->name('list');
        Route::post('/create', 'CreateContainerController@create')->name('create');
        Route::post('/create/load', 'CreateLoadContainerController@create')->name('create.load');
        Route::put('/update/{id}', 'UpdateContainerController@update')->name('update');
        Route::delete('/delete/{id}', 'DeleteContainerController@delete')->name('delete');
        Route::put('/assign-packing_list/{id}', 'AssignPackingListContainerController@assign')->name('assign.packing_list');
        Route::put('/reschedule/{id}', 'RescheduleContainerController@reschedule')->name('reschedule');
        Route::put('/update-dispatch-date/{id}', 'UpdateDispatchDateContainerController@update')->name('update_dispatch_date');
        Route::put('/update-drop-date/{id}', 'UpdateDropDateContainerController@update')->name('update_drop_date');
        Route::put('/complete/{id}', 'CompleteContainerController@complete')->name('complete');
        Route::post('/{id}/remark/create', 'CreateContainerRemarkController@create')->name('remark.create');
    });

    Route::group(['namespace' => 'Packages', 'as' => 'package.', 'prefix' => 'package'], function () {
        Route::get('/{id}/show', 'FetchPackageController@fetch')->name('show');
        Route::get('/list', 'ListPackagesController@list')->name('list');
        Route::post('/create', 'CreatePackageController@create')->name('create');
        Route::put('/update/{id}', 'UpdatePackageController@update')->name('update');
        Route::delete('/delete/{id}', 'DeletePackageController@delete')->name('delete');
        Route::get('/inbound-custom-cleared', 'InboundCustomClearedController@list')->name('list.inbound.custom.cleared');
        Route::put('/switch-packing-list/{id}', 'SwitchPackagePackingListController@switch')->name('switch.packing_list');

        Route::group(['namespace' => 'PackageItems', 'prefix' => 'item', 'as' => 'item.'], function () {
            Route::get('/{id}/show', 'FetchPackageItemController@fetch')->name('show');
            Route::get('/list', 'ListPackageItemsController@list')->name('list');
            Route::post('/create', 'CreatePackageItemController@create')->name('create');
            Route::put('/update/{id}', 'UpdatePackageItemController@update')->name('update');
            Route::delete('/delete/{id}', 'DeletePackageItemController@delete')->name('delete');
        });
    });

});
