<?php

use Illuminate\Support\Facades\Route;

Route::group(['prefix' => 'company', 'as' => 'company.', 'namespace' => 'Companies'], function () {
    Route::get('/{id}/show', 'FetchCompanyController@fetch')->name('show');
    Route::get('/list', 'ListCompaniesController@list')->name('list');
    Route::post('/create', 'CreateCompanyController@create')->name('create');
    Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update');
    Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');

    Route::group(['prefix' => '{id}/segment', 'as' => 'segment.'], function () {
        Route::post('/assign', 'AssignCompanyToSegmentController@assign')->name('assign');
        Route::delete('/detach/{segment_id}', 'RemoveCompanyFromSegmentController@detach')->name('detach');
    });

    Route::group(['prefix' => '{id}/connection/{company_connection_id}', 'as' => 'connection.'], function () {
        Route::post('/assign', 'AssignCompanyConnectionToConnectionSegmentController@assign')->name('assign');
        Route::delete('/detach/{segment_id}', 'RemoveCompanyConnectionFromConnectionSegmentController@detach')->name('detach');
    });

    Route::group(['prefix' => '{id}/currency', 'as' => 'currency.'], function () {
        Route::post('/convert', 'FetchCompanyBookingQuotationController@fetch')->name('convert');
    });

    Route::put('supplier/{id}/currencies/update', 'UpdateSupplierCurrenciesController@update')->name('supplier.currencies.update');

    Route::group(['prefix' => '{id}/identification', 'as' => 'identification.'], function () {
        Route::post('/create', 'CreateIdentificationDocumentController@create')->name('create');
        Route::put('/{document_id}/approval/{status}', 'ApproveIdentificationDocumentController@approve')->where('status', 'approve|reject')->name('approval');
    });

});