import "../base.api"

type (
    // The data of msg information | Msg信息
    MsgInfo {
        BaseIDInfo

        // Status 1: normal 2: ban | 状态 1 正常 2 禁用 
        Status  *uint8 `json:"status,optional"`

        // 发送方微信ID 
        Fromwxid  *string `json:"fromwxid,optional"`

        // 接收人微信ID/群ID 
        Toid  *string `json:"toid,optional"`

        // 消息类型 
        Msgtype  *int32 `json:"msgtype,optional"`

        // 消息 
        Msg  *string `json:"msg,optional"`

        // 批次号 
        BatchNo  *string `json:"batchNo,optional"`
    }

    // The response data of msg list | Msg列表数据
    MsgListResp {
        BaseDataInfo

        // Msg list data | Msg列表数据
        Data MsgListInfo `json:"data"`
    }

    // Msg list data | Msg列表数据
    MsgListInfo {
        BaseListInfo

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

    // Get msg list request params | Msg列表请求参数
    MsgListReq {
        PageInfo

        // 状态
        Status  *uint8 `json:"status,optional"`

        // 接收人微信ID/群ID 
        Toid  *string `json:"toid,optional"`

		// 群发消息ID
		BatchId *uint64 `json:"batchId"`
    }

    // Msg information response | Msg信息返回体
    MsgInfoResp {
        BaseDataInfo

        // Msg information | Msg数据
        Data MsgInfo `json:"data"`
    }
)

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

service Wechat {
    // Create msg information | 创建Msg
    @handler createMsg
    post /msg/create (MsgInfo) returns (BaseMsgResp)

    // Update msg information | 更新Msg
    @handler updateMsg
    post /msg/update (MsgInfo) returns (BaseMsgResp)

    // Delete msg information | 删除Msg信息
    @handler deleteMsg
    post /msg/delete (IDsReq) returns (BaseMsgResp)

    // Get msg list | 获取Msg列表
    @handler getMsgList
    post /msg/list (MsgListReq) returns (MsgListResp)

    // Get msg by ID | 通过ID获取Msg
    @handler getMsgById
    post /msg (IDReq) returns (MsgInfoResp)
}