package model

import (
	"fmt"
)

// 批量发送消息请求对象
type BatchSendMessageRequest struct {
	// 公共请求参数
	common *CommonRequest

	// 消息正文列表
	msgBodyList []string

	// 单位为秒，表示该消息发送到队列后，需要延时多久用户才可见该消息。
	delaySeconds int
}

// 获取请求方法名
func (this *BatchSendMessageRequest) GetActionName() string {
	return "BatchSendMessage"
}

// SetCommonRequest 设置公共请求对象
func (this *BatchSendMessageRequest) SetCommonRequest(commonRequest *CommonRequest) {
	this.common = commonRequest
}

// AssembleParamMap 组装参数字典
// 返回值
// map[string]string:请求参数字典
func (this *BatchSendMessageRequest) AssembleParamMap() map[string]string {
	paramMap := this.common.AssembleParamMap()
	for index, msg := range this.msgBodyList {
		key := fmt.Sprintf("msgBody.%d", index)
		paramMap[key] = msg
	}
	paramMap["delaySeconds"] = fmt.Sprintf("%d", this.delaySeconds)

	return paramMap
}

func NewBatchSendMessageRequest(msgBodyList []string, delaySeconds int) *BatchSendMessageRequest {
	return &BatchSendMessageRequest{
		msgBodyList:  msgBodyList,
		delaySeconds: delaySeconds,
	}
}

// 批量发送消息请求返回结果对象
type BatchSendMessageResponse struct {
	*CommonResponse

	// message信息列表
	MsgInfoList []*MessageInfo `json:"msgInfoList"`
}

func NewBatchSendMessageResponse() *BatchSendMessageResponse {
	return &BatchSendMessageResponse{}
}
