package model

import (
	"fmt"
)

// 批量删除消息请求对象
type BatchDeleteMessageRequest struct {
	// 公共请求参数
	common *CommonRequest

	// 上次消费消息时返回的消息句柄列表
	receiptHandleList []string
}

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

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

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

	return paramMap
}

func NewBatchDeleteMessageRequest(receiptHandleList []string) *BatchDeleteMessageRequest {
	return &BatchDeleteMessageRequest{
		receiptHandleList: receiptHandleList,
	}
}

// 批量删除消息请求返回结果对象
type BatchDeleteMessageResponse struct {
	*CommonResponse

	// 无法成功删除的错误列表
	ErrorList []*ErrorInfo `json:"errorList"`
}

func NewBatchDeleteMessageResponse() *BatchDeleteMessageResponse {
	return &BatchDeleteMessageResponse{}
}
