import "../base.api"

type (
    // The data of tutorial information | Tutorial信息
    TutorialInfo {
        BaseIDInfo

        // employee_id | 员工ID 
        EmployeeId  *uint64 `json:"employeeId,optional"`

        // index | 序号 
        Index  *int `json:"index,optional"`

        // title | 标题 
        Title  *string `json:"title,optional"`

        // content | 内容 
        Content  *string `json:"content,optional"`
    }

    // The response data of tutorial list | Tutorial列表数据
    TutorialListResp {
        BaseDataInfo

        // Tutorial list data | Tutorial列表数据
        Data TutorialListInfo `json:"data"`
    }

    // Tutorial list data | Tutorial列表数据
    TutorialListInfo {
        BaseListInfo

        // The API list data | Tutorial列表数据
        Data  []TutorialInfo  `json:"data"`
    }

    // Get tutorial list request params | Tutorial列表请求参数
    TutorialListReq {
        PageInfo

        // title | 标题 
        Title  *string `json:"title,optional"`

        // content | 内容 
        Content  *string `json:"content,optional"`
    }

    // Tutorial information response | Tutorial信息返回体
    TutorialInfoResp {
        BaseDataInfo

        // Tutorial information | Tutorial数据
        Data TutorialInfo `json:"data"`
    }
)

@server(
    jwt: Auth
    group: tutorial
    middleware: Authority
)

service Wechat {
    // Create tutorial information | 创建Tutorial
    @handler createTutorial
    post /tutorial/create (TutorialInfo) returns (BaseMsgResp)

    // Update tutorial information | 更新Tutorial
    @handler updateTutorial
    post /tutorial/update (TutorialInfo) returns (BaseMsgResp)

    // Delete tutorial information | 删除Tutorial信息
    @handler deleteTutorial
    post /tutorial/delete (IDsReq) returns (BaseMsgResp)

    // Get tutorial list | 获取Tutorial列表
    @handler getTutorialList
    post /tutorial/list (TutorialListReq) returns (TutorialListResp)

    // Get tutorial by ID | 通过ID获取Tutorial
    @handler getTutorialById
    post /tutorial (IDReq) returns (TutorialInfoResp)
}
