<?php

Route::group(['namespace' => 'User', 'prefix' => 'user-backsys/api'], function () {
	Route::group(['namespace' => 'Api'], function () {
    	Route::post('login', ['as' => 'api.user.login', 'uses' => 'LoginController@login']);
		// User
		Route::prefix('user')->group(function () {
			Route::get('self', 
	    		[
					'as' => 'api.user.self', 
					'uses' => 'UserController@self', 
	    		]
	    	);
	    	Route::put('update', 
	    		[
					'as' => 'api.user.update', 
					'uses' => 'UserController@update', 
	    		]
	    	);
	    	Route::post('valid-check/{hash_id?}', 
	    		[
					'as' => 'api.user.valid-check', 
					'uses' => 'UserController@validCheck', 
	    		]
	    	);
		});

		// Entity
		Route::prefix('entity')->group(function () {
			Route::get('list', 
	    		[
					'as' => 'api.entity.list', 
					'uses' => 'EntityController@list', 
					'middleware' => ['permission:view entity']
	    		]
	    	);
	    	Route::get('show/{hash_id}', 
	    		[
					'as' => 'api.entity.show', 
					'uses' => 'EntityController@show', 
					'middleware' => ['permission:view entity']
	    		]
	    	);
	    	Route::post('store', 
	    		[
					'as' => 'api.entity.store', 
					'uses' => 'EntityController@store', 
					'middleware' => ['permission:add entity']
	    		]
	    	);
	    	Route::put('update/{hash_id}', 
	    		[
					'as' => 'api.entity.update', 
					'uses' => 'EntityController@update', 
					'middleware' => ['permission:edit entity']
	    		]
	    	);
	    	Route::delete('delete/{hash_id}', 
	    		[
					'as' => 'api.entity.delete', 
					'uses' => 'EntityController@delete', 
					'middleware' => ['permission:delete entity']
	    		]
	    	);
		});

		// Entity Signature
		Route::prefix('entity-signature')->group(function () {
			Route::get('list', 
	    		[
					'as' => 'api.entity-signature.list', 
					'uses' => 'EntitySignatureController@list', 
					'middleware' => ['permission:view entity']
	    		]
	    	);
	    	Route::get('show/{hash_id}', 
	    		[
					'as' => 'api.entity-signature.show', 
					'uses' => 'EntitySignatureController@show', 
					'middleware' => ['permission:view entity']
	    		]
	    	);
	    	Route::post('store', 
	    		[
					'as' => 'api.entity-signature.store', 
					'uses' => 'EntitySignatureController@store', 
					'middleware' => ['permission:add entity']
	    		]
	    	);
	    	Route::put('update/{hash_id}', 
	    		[
					'as' => 'api.entity-signature.update', 
					'uses' => 'EntitySignatureController@update', 
					'middleware' => ['permission:edit entity']
	    		]
	    	);
	    	Route::delete('delete/{hash_id}', 
	    		[
					'as' => 'api.entity-signature.delete', 
					'uses' => 'EntitySignatureController@delete', 
					'middleware' => ['permission:delete entity']
	    		]
	    	);
		});

		// Contract Templete
		Route::prefix('contract-template')->group(function () {
			Route::get('list', 
	    		[
					'as' => 'api.contract-template.list', 
					'uses' => 'ContractTemplateController@list', 
					'middleware' => ['permission:view contract_template']
	    		]
	    	);
	    	Route::get('show/{hash_id}', 
	    		[
					'as' => 'api.contract-template.show', 
					'uses' => 'ContractTemplateController@show', 
					'middleware' => ['permission:view contract_template']
	    		]
	    	);
	    	Route::post('store', 
	    		[
					'as' => 'api.contract-template.store', 
					'uses' => 'ContractTemplateController@store', 
					'middleware' => ['permission:add contract_template']
	    		]
	    	);
	    	Route::put('update/{hash_id}', 
	    		[
					'as' => 'api.contract-template.update', 
					'uses' => 'ContractTemplateController@update', 
					'middleware' => ['permission:edit contract_template']
	    		]
	    	);
	    	Route::delete('delete/{hash_id}', 
	    		[
					'as' => 'api.contract-template.delete', 
					'uses' => 'ContractTemplateController@delete', 
					'middleware' => ['permission:delete contract_template']
	    		]
	    	);
	    	Route::post('valid-check/{hash_id?}', 
	    		[
					'as' => 'api.contract-template.valid-check', 
					'uses' => 'ContractTemplateController@validCheck', 
	    		]
	    	);
		});

		// Contract Templete Obligation
		Route::prefix('contract-template-obligation')->group(function () {
			Route::get('list', 
	    		[
					'as' => 'api.contract-template-obligation.list', 
					'uses' => 'ContractTemplateObligationController@list', 
					'middleware' => ['permission:view contract_template_obligation']
	    		]
	    	);
	    	Route::get('show/{hash_id}', 
	    		[
					'as' => 'api.contract-template-obligation.show', 
					'uses' => 'ContractTemplateObligationController@show', 
					'middleware' => ['permission:view contract_template_obligation']
	    		]
	    	);
	    	Route::post('store', 
	    		[
					'as' => 'api.contract-template-obligation.store', 
					'uses' => 'ContractTemplateObligationController@store', 
					'middleware' => ['permission:add contract_template_obligation']
	    		]
	    	);
	    	Route::put('update/{hash_id}', 
	    		[
					'as' => 'api.contract-template-obligation.update', 
					'uses' => 'ContractTemplateObligationController@update', 
					'middleware' => ['permission:edit contract_template_obligation']
	    		]
	    	);
	    	Route::delete('delete/{hash_id}', 
	    		[
					'as' => 'api.contract-template-obligation.delete', 
					'uses' => 'ContractTemplateObligationController@delete', 
					'middleware' => ['permission:delete contract_template_obligation']
	    		]
	    	);
		});

		// Contract Templete Obligation
		Route::prefix('contract-template-obligation-dependency')->group(function () {
			Route::get('list', 
	    		[
					'as' => 'api.contract-template-obligation-dependency.list', 
					'uses' => 'ContractTemplateObligationDependencyController@list', 
					'middleware' => ['permission:view contract_template_obligation_dependency']
	    		]
	    	);
	    	Route::get('show/{hash_id}', 
	    		[
					'as' => 'api.contract-template-obligation-dependency.show', 
					'uses' => 'ContractTemplateObligationDependencyController@show', 
					'middleware' => ['permission:view contract_template_obligation_dependency']
	    		]
	    	);
	    	Route::post('store', 
	    		[
					'as' => 'api.contract-template-obligation-dependency.store', 
					'uses' => 'ContractTemplateObligationDependencyController@store', 
					'middleware' => ['permission:add contract_template_obligation_dependency']
	    		]
	    	);
	    	Route::put('update/{hash_id}', 
	    		[
					'as' => 'api.contract-template-obligation-dependency.update', 
					'uses' => 'ContractTemplateObligationDependencyController@update', 
					'middleware' => ['permission:edit contract_template_obligation_dependency']
	    		]
	    	);
	    	Route::delete('delete/{hash_id}', 
	    		[
					'as' => 'api.contract-template-obligation-dependency.delete', 
					'uses' => 'ContractTemplateObligationDependencyController@delete', 
					'middleware' => ['permission:delete contract_template_obligation_dependency']
	    		]
	    	);
		});


		// Contract
		Route::prefix('contract')->group(function () {
			Route::get('list', 
	    		[
					'as' => 'api.contract.list', 
					'uses' => 'ContractController@list', 
					'middleware' => ['permission:view contract']
	    		]
	    	);
	    	Route::get('show/{hash_id}', 
	    		[
					'as' => 'api.contract.show', 
					'uses' => 'ContractController@show', 
					'middleware' => ['permission:view contract']
	    		]
	    	);
	    	Route::post('generate', 
	    		[
					'as' => 'api.contract.generate', 
					'uses' => 'ContractController@generate', 
					'middleware' => ['permission:add contract']
	    		]
	    	);
		});

		// contract generate
		// contract assign entity
		// contract active
	});
});