package model

import (
	"fmt"
)

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

	// 消息正文
	msgBody string

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

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

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

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

	return paramMap
}

func NewSendMessageRequest(msgBody string, delaySeconds int) *SendMessageRequest {
	return &SendMessageRequest{
		msgBody:      msgBody,
		delaySeconds: delaySeconds,
	}
}

// 发送消息请求返回结果对象
type SendMessageResponse struct {
	// 公共请求结果
	*CommonResponse

	// 服务器生成消息的唯一标识Id
	MsgId string `json:"msgId"`
}

func NewSendMessageResponse() *SendMessageResponse {
	return &SendMessageResponse{}
}
