<?php
use Illuminate\Support\Facades\Route;

Route::post('auth/login', [App\Http\Controllers\Auth\Index::class, 'login']);

Route::prefix('auth')->middleware(['auth:api'])->group(function ($router) {
	Route::post('logout', [App\Http\Controllers\Auth\Index::class, 'logout']);
	Route::post('refresh', [App\Http\Controllers\Auth\Index::class, 'refresh']);
	Route::get('me', [App\Http\Controllers\Auth\User::class, 'index']);
});


Route::prefix('system')->middleware(['auth:api'])->group(function ($router) {
	Route::get('version', [App\Http\Controllers\System\Index::class, 'version']);
	Route::get('setting', [App\Http\Controllers\System\Setting::class, 'index']);
});

Route::prefix('user')->middleware(['auth:api'])->group(function ($router) {
	/* 用户路由 */
	Route::controller(App\Http\Controllers\Auth\User::class)->group(function () {
		Route::get('list', 'index');
		Route::post('add', 'add');
		Route::put('edit', 'edit');
		Route::post('passwd', 'passwd');
		Route::get('info', 'info');
	});

	/* 日志路由 */
	Route::controller(App\Http\Controllers\Auth\Log::class)->group(function () {
		Route::get('log', 'index');
		Route::get('log/my', 'my');
	});

	/* 前端菜单 */
	Route::controller(App\Http\Controllers\Auth\Permission::class)->group(function () {
		Route::get('menu', 'index');
		Route::get('menu/my', 'my');
		Route::post('menu', 'add');
		Route::put('menu', 'edit');
	});

	/* 部门路由 */
	Route::controller(App\Http\Controllers\Auth\Department::class)->group(function () {
		Route::get('department', 'index');
		Route::post('department', 'add');
		Route::put('department', 'edit');
		Route::delete('department', 'delete');
	});

	/* 角色路由 */
	Route::controller(App\Http\Controllers\Auth\Role::class)->group(function () {
		Route::get('role', 'index');
		Route::post('role', 'add');
		Route::put('role', 'edit');
		Route::delete('role', 'delete');
	});
});
