<?php

use Illuminate\Support\Facades\Route;
use Modules\System\Http\Controllers\NoticesController;
use Modules\System\Http\Controllers\NoticeTypesController;

Route::prefix('system')->group(function () {
    // 通知管理
    Route::prefix('notices')->group(function(){
        // 通知分类
        Route::prefix('types')->group(function (){
            // 添加通知分类
            Route::post('add',[NoticeTypesController::class, 'add']);
            // 通知分类列表
            Route::any('list',[NoticeTypesController::class, 'list']);
            //  删除通知分类
            Route::post('del/{id}',[NoticeTypesController::class, 'delete']);
        });
        // 通知管理
        Route::prefix('notice')->group(function(){
            // 添加通知
            Route::post('add',[NoticesController::class, 'addNotice']);
            // 通知列表
            Route::any('list',[NoticesController::class, 'list']);
            //  删除通知
            Route::post('del/{id}',[NoticesController::class, 'delete']);
            //   修改通知状态
            Route::post('enable/{id}',[NoticesController::class, 'enable']);
            // 获取编辑信息
            Route::get('edit/{id}',[NoticesController::class, 'info']);
            // 保存编辑
            Route::post('edit/{id}',[NoticesController::class, 'edit']);

            // 不判断权限
            Route::prefix("")->group(function (){
                // 通知对象接口
                Route::any('obj_option',[NoticesController::class, 'objOption'])->withoutMiddleware(config('catch.route.middlewares'));
                // 我的通知
                Route::any('mine',[NoticesController::class, 'myNotices'])->withoutMiddleware(config('catch.route.middlewares'));
                //  已读
                Route::get('read/{id}',[NoticesController::class, 'setRead'])->withoutMiddleware(config('catch.route.middlewares'));
                // 用户删除
                Route::get('user_del/{id}',[NoticesController::class, 'userDel'])->withoutMiddleware(config('catch.route.middlewares'));
                // 查看通知信息
                Route::any('detail/{id}',[NoticesController::class, 'detail'])->withoutMiddleware(config('catch.route.middlewares'));
                // 获取首页弹窗消息
                Route::any('popup',[NoticesController::class, 'getPopup'])->withoutMiddleware(config('catch.route.middlewares'));

            });

        });

    });

});

