package model

import (
	"fmt"
)

// 消费消息请求对象
type ReceiveMessageRequest struct {
	// 公共请求参数
	common *CommonRequest

	// 本次请求的长轮询等待时间。取值范围0 - 30秒，如果不设置该参数，则默认使用队列属性中的 pollingWaitSeconds 值。
	pollingWaitSeconds int
}

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

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

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

	return paramMap
}

func NewReceiveMessageRequest(pollingWaitSeconds int) *ReceiveMessageRequest {
	return &ReceiveMessageRequest{
		pollingWaitSeconds: pollingWaitSeconds,
	}
}

// 消费消息请求返回结果对象
type ReceiveMessageResponse struct {
	*CommonResponse

	// 消息对象
	*MessageInfo
}

func NewReceiveMessageResponse() *ReceiveMessageResponse {
	return &ReceiveMessageResponse{}
}
