<?php

namespace App\Http\Controllers\Channel\Notice;

use App\Http\Controllers\Channel\BaseController;
use App\Http\Controllers\Channel\Notice\Transformers\NoticeTypeTransformer;
use App\Modules\Notice\Services\NoticeService;
use Illuminate\Http\Request;

class NoticeTypesController extends BaseController
{
    /**
     * @apiDefine Notice 公告
     */

    /**
     * @apiVersion 1.0.0
     * @apiDescription 获取公告分类列表
     * @api {GET} noticeTypes 获取公告分类列表
     * @apiGroup Notice
     * @apiName noticeTypes
     * @apiSuccess {Number}  id 公告分类id.
     * @apiSuccess {String}  name 分类名称.
     * @apiSuccessExample {json} Success-Response:
     *
     *     {
     *         "code": 0,
     *         "msg": "",
     *         "data":
     *         [
     *             {
     *                 "id": 121,
     *                 "name": "教程",
     *             }
     *         ]
     *     }
     */
    function get_list(Request $request)
    {
        $notic_types = NoticeService::getAllNoticeTypeList();

        return response()->collection(new NoticeTypeTransformer(),$notic_types);
    }
    
}