<?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::put('/update/{id}/profile', 'UpdateCompanyProfileController@update')->name('profile.update');
    Route::put('update/{id}/status', 'UpdateCompanyStatusController@update')->name('status.update');
    Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
    Route::put('/name-and-debtor/update/{id}', 'UpdateCompanyNameAndDebtorController@update')->name('update.nameAndDebtor');

    Route::get('/business-type/list', 'ListBusinessTypesController@list')->name('business_type.list');
    Route::get('/company-type/list', 'ListCompanyTypesController@list')->name('company_type.list');

    Route::put('/update/debtor/{id}', 'UpdateCompanyDebtorController@update')->name('delete');

    Route::post('/team/create', 'AddNewMemberController@create')->name('team.create');

    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}/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');
    });

});
