import "../base.api"

type (
    // The data of batch msg information | BatchMsg信息
    BatchMsgInfo {
        BaseIDInfo

        // 状态 0 未开始 1 开始发送 2 发送完成 3 发送中止 
        Status  *uint8 `json:"status,optional"`

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

		// 任务名称
		TaskName  *string `json:"taskName,optional"`

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

        // 内容 
        Msg  *string `json:"msg,optional"`

        // 发送规则 all 全部 tag1,tag2 按tag发送 
        Tag  *string `json:"tag,optional"`

        // 总数 
        Total  *int32 `json:"total,optional"`

        // 成功数量 
        Success  *int32 `json:"success,optional"`

        // 失败数量 
        Fail  *int32 `json:"fail,optional"`

        // 开始时间 
        StartTime  *int64 `json:"startTime,optional"`

        StartTimeStr  *string `json:"startTimeStr,optional"`

        // 结束时间 
        StopTime  *int64 `json:"stopTime,optional"`

	    // 发送时间
		SendTime *int64 `json:"sendTime,optional"`

        // 标签列表
        Labels  []uint64 `json:"labels,optional"`
		GroupLabels  []uint64 `json:"groupLabels,optional"`

		// 标签列表
		Type  *int32 `json:"type,optional"`
    }

    // The response data of batch msg list | BatchMsg列表数据
    BatchMsgListResp {
        BaseDataInfo

        // BatchMsg list data | BatchMsg列表数据
        Data BatchMsgListInfo `json:"data"`
    }

    // BatchMsg list data | BatchMsg列表数据
    BatchMsgListInfo {
        BaseListInfo

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

    // Get batch msg list request params | BatchMsg列表请求参数
    BatchMsgListReq {
        PageInfo

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

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

        // 内容 
        Msg  *string `json:"msg,optional"`

		// 任务名称
		TaskName  *string `json:"taskName,optional"`

		// 群发类型
		Type *int32 `json:"type"`
    }

    // BatchMsg information response | BatchMsg信息返回体
    BatchMsgInfoResp {
        BaseDataInfo

        // BatchMsg information | BatchMsg数据
        Data BatchMsgInfo `json:"data"`
    }
)

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

service Wechat {
    // Create batch msg information | 创建BatchMsg
    @handler createBatchMsg
    post /batch_msg/create (BatchMsgInfo) returns (BaseMsgResp)

    // Update batch msg information | 更新BatchMsg
    @handler updateBatchMsg
    post /batch_msg/update (BatchMsgInfo) returns (BaseMsgResp)

    // Delete batch msg information | 删除BatchMsg信息
    @handler deleteBatchMsg
    post /batch_msg/delete (IDsReq) returns (BaseMsgResp)

    // Get batch msg list | 获取BatchMsg列表
    @handler getBatchMsgList
    post /batch_msg/list (BatchMsgListReq) returns (BatchMsgListResp)

    // Get batch msg by ID | 通过ID获取BatchMsg
    @handler getBatchMsgById
    post /batch_msg (IDReq) returns (BatchMsgInfoResp)

	// Stop batch_msg by ID | 通过ID停止BatchMsg
	@handler stopBatchMsg
	post /batch_msg/stop (IDReq) returns (BaseMsgResp)
}